Skip to content

Commit 243fca7

Browse files
committed
feat: unpin file in working set if moved after a regular file
1 parent e579bbb commit 243fca7

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/project/WorkingSetView.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,21 @@ define(function (require, exports, module) {
794794
}
795795
} else if (sourceView.paneId === currentView.paneId) {
796796
// item was reordered
797-
MainViewManager._moveWorkingSetItem(sourceView.paneId, startingIndex, $el.index());
797+
const newIndex = $el.index();
798+
MainViewManager._moveWorkingSetItem(sourceView.paneId, startingIndex, newIndex);
799+
800+
// Check if the dragged file is pinned - if moved after an unpinned file, unpin it
801+
const isPinned = MainViewManager.isPathPinned(sourceView.paneId, sourceFile.fullPath);
802+
if (isPinned && newIndex > 0) {
803+
const workingSet = MainViewManager.getWorkingSet(sourceView.paneId);
804+
const prevFilePath = workingSet[newIndex - 1].fullPath;
805+
806+
if (!MainViewManager.isPathPinned(sourceView.paneId, prevFilePath)) {
807+
CommandManager.get(Commands.FILE_UNPIN).setEnabled(true);
808+
CommandManager.execute(Commands.FILE_UNPIN, { file: sourceFile, paneId: sourceView.paneId });
809+
}
810+
}
811+
798812
postDropCleanup();
799813
} else {
800814
// If the same doc view is present in the destination pane prevent drop

0 commit comments

Comments
 (0)