@@ -143,6 +143,7 @@ define(function (require, exports, module) {
143143
144144 const isDirty = Helper . _isFileModified ( FileSystem . getFileForPath ( entry . path ) ) ;
145145 const isPlaceholder = entry . isPlaceholder === true ;
146+ const isPinned = MainViewManager . isPathPinned ( paneId , entry . path ) ;
146147
147148 let gitStatus = "" ; // this will be shown in the tooltip when a tab is hovered
148149 let gitStatusClass = "" ; // for styling
@@ -173,12 +174,15 @@ define(function (require, exports, module) {
173174 ${ isActive ? "active" : "" }
174175 ${ isDirty ? "dirty" : "" }
175176 ${ isPlaceholder ? "placeholder" : "" }
177+ ${ isPinned ? "pinned" : "" }
176178 ${ gitStatusClass } "
177179 data-path="${ entry . path } "
178180 title="${ Phoenix . app . getDisplayPath ( entry . path ) } ${ gitStatus ? " (" + gitStatus + ")" : "" } ">
179181 <div class="tab-icon"></div>
180182 <div class="tab-name"></div>
181- <div class="tab-close"><i class="fa-solid fa-times"></i></div>
183+ ${ isPinned ?
184+ '<div class="tab-pin"><i class="fa-solid fa-thumbtack"></i></div>' :
185+ '<div class="tab-close"><i class="fa-solid fa-times"></i></div>' }
182186 </div>`
183187 ) ;
184188
@@ -514,6 +518,14 @@ define(function (require, exports, module) {
514518
515519 CommandManager . execute ( Commands . FILE_CLOSE , { file : fileObj , paneId : paneId } ) ; // close the file
516520 }
521+
522+ // check if the clicked element is the pin icon, if yes then we need to unpin it
523+ if ( $ ( event . target ) . hasClass ( "fa-thumbtack" ) || $ ( event . target ) . closest ( ".tab-pin" ) . length ) {
524+ event . preventDefault ( ) ;
525+ event . stopPropagation ( ) ;
526+
527+ CommandManager . execute ( Commands . FILE_UNPIN , { file : fileObj , paneId : paneId } ) ;
528+ }
517529 } ) ;
518530
519531 // add listener for tab close button to show the tooltip along with the keybinding
@@ -655,7 +667,9 @@ define(function (require, exports, module) {
655667 "workingSetAddList" ,
656668 "workingSetRemoveList" ,
657669 "workingSetUpdate" ,
658- "_workingSetDisableAutoSort"
670+ "_workingSetDisableAutoSort" ,
671+ "workingSetPinned" ,
672+ "workingSetUnpinned"
659673 ] ;
660674 MainViewManager . off ( events . join ( " " ) , updateTabs ) ;
661675 MainViewManager . on ( events . join ( " " ) , updateTabs ) ;
0 commit comments