vertical split tabs #394

This commit is contained in:
Jan Prochazka
2023-03-05 10:43:04 +01:00
parent 1061d2aba2
commit 2dadd1f437
8 changed files with 88 additions and 12 deletions

View File

@@ -29,9 +29,24 @@ export function markTabSaved(tabid) {
}
export function setSelectedTabFunc(files, tabid) {
const oldSelected = files.find(x => x.selected);
const newSelected = files.find(x => x.tabid == tabid);
const changeVisibleSecondary = (oldSelected.multiTabIndex || 0) != (newSelected.multiTabIndex || 0);
return [
...(files || []).filter(x => x.tabid != tabid).map(x => ({ ...x, selected: false })),
...(files || []).filter(x => x.tabid == tabid).map(x => ({ ...x, selected: true })),
...(files || [])
.filter(x => x.tabid != tabid)
.map(x => ({
...x,
selected: false,
visibleSecondary: changeVisibleSecondary ? x.selected : x.visibleSecondary,
})),
...(files || [])
.filter(x => x.tabid == tabid)
.map(x => ({
...x,
selected: true,
visibleSecondary: false,
})),
];
}