@@ -6,6 +6,7 @@ define(function (require, exports, module) {
66 const PreferencesManager = require ( "preferences/PreferencesManager" ) ;
77 const CommandManager = require ( "command/CommandManager" ) ;
88 const Commands = require ( "command/Commands" ) ;
9+ const DocumentManager = require ( "document/DocumentManager" ) ;
910
1011
1112 const Helper = require ( "./helper" ) ;
@@ -101,7 +102,7 @@ define(function (require, exports, module) {
101102 // Create the tab element with the structure we need
102103 // tab name is written as a separate div because it may include directory info which we style differently
103104 const $tab = $ (
104- `<div class="tab ${ isActive ? 'active' : '' } "
105+ `<div class="tab ${ isActive ? 'active' : '' } ${ isDirty ? 'dirty' : '' } "
105106 data-path="${ entry . path } "
106107 title="${ entry . path } ">
107108 <div class="tab-icon"></div>
@@ -353,7 +354,6 @@ define(function (require, exports, module) {
353354 MainViewManager . off ( "activePaneChange paneCreate paneDestroy paneLayoutChange" , createTabBar ) ;
354355 MainViewManager . on ( "activePaneChange paneCreate paneDestroy paneLayoutChange" , createTabBar ) ;
355356
356-
357357 // editor handlers
358358 EditorManager . off ( "activeEditorChange" , createTabBar ) ;
359359 EditorManager . on ( "activeEditorChange" , createTabBar ) ;
@@ -362,6 +362,13 @@ define(function (require, exports, module) {
362362 MainViewManager . on ( "workingSetAdd" , workingSetChanged ) ;
363363 MainViewManager . on ( "workingSetRemove" , workingSetChanged ) ;
364364 MainViewManager . on ( "workingSetSort" , workingSetChanged ) ;
365+
366+ // file dirty flag change handler
367+ DocumentManager . on ( "dirtyFlagChange" , function ( event , doc ) {
368+ const filePath = doc . file . fullPath ;
369+ const $tab = $tabBar . find ( `.tab[data-path="${ filePath } "]` ) ;
370+ $tab . toggleClass ( 'dirty' , doc . isDirty ) ;
371+ } ) ;
365372 }
366373
367374
0 commit comments