Skip to content

Commit 5034fc9

Browse files
committed
feat: protect pinned files from bulk close operations
1 parent 9843e7b commit 5034fc9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • src/extensions/default/CloseOthers

src/extensions/default/CloseOthers/main.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,24 @@ define(function (require, exports, module) {
6060
i;
6161

6262
for (i = start; i < end; i++) {
63-
files.push(workingSetList[i]);
63+
// ignore pinned files
64+
if (!MainViewManager.isPathPinned(MainViewManager.ACTIVE_PANE, workingSetList[i].fullPath)) {
65+
files.push(workingSetList[i]);
66+
}
6467
}
6568

6669
CommandManager.execute(Commands.FILE_CLOSE_LIST, {fileList: files});
6770
}
6871

6972
/**
70-
* Handle Close All - closes all files in the active pane
73+
* Handle Close All - closes all files in the active pane (except pinned files)
7174
*/
7275
function handleCloseAll() {
7376
let workingSetList = MainViewManager.getWorkingSet(MainViewManager.ACTIVE_PANE);
74-
CommandManager.execute(Commands.FILE_CLOSE_LIST, {fileList: workingSetList});
77+
let unpinnedFiles = workingSetList.filter(function(file) {
78+
return !MainViewManager.isPathPinned(MainViewManager.ACTIVE_PANE, file.fullPath);
79+
});
80+
CommandManager.execute(Commands.FILE_CLOSE_LIST, {fileList: unpinnedFiles});
7581
}
7682

7783
/**

0 commit comments

Comments
 (0)