@@ -24,6 +24,7 @@ define(function (require, exports, module) {
2424 const MainViewManager = require ( "view/MainViewManager" ) ;
2525 const CommandManager = require ( "command/CommandManager" ) ;
2626 const Commands = require ( "command/Commands" ) ;
27+ const FileSystem = require ( "filesystem/FileSystem" ) ;
2728
2829 /**
2930 * These variables track the drag and drop state of tabs
@@ -307,6 +308,21 @@ define(function (require, exports, module) {
307308 newPosition -- ;
308309 }
309310 MainViewManager . _moveWorkingSetItem ( paneId , draggedIndex , newPosition ) ;
311+
312+ // we check if the dragged file is pinned, cause if it is we might need to unpin it,
313+ // if it is dropped after an unpinned file
314+ const isDraggedFilePinned = MainViewManager . isPathPinned ( paneId , draggedPath ) ;
315+
316+ if ( isDraggedFilePinned && newPosition > 0 ) {
317+ const newWorkingSet = MainViewManager . getWorkingSet ( paneId ) ;
318+ const prevFilePath = newWorkingSet [ newPosition - 1 ] . fullPath ;
319+
320+ // if the prev file is not pinned, we unpin this file too!
321+ if ( ! MainViewManager . isPathPinned ( paneId , prevFilePath ) ) {
322+ const fileObj = FileSystem . getFileForPath ( draggedPath ) ;
323+ CommandManager . execute ( Commands . FILE_UNPIN , { file : fileObj , paneId : paneId } ) ;
324+ }
325+ }
310326 }
311327 }
312328
0 commit comments