Skip to content

Commit 040f06d

Browse files
committed
Display ribbon and status bar indicators properly
1 parent eba40a2 commit 040f06d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/main.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,6 @@ export default class CustomSortPlugin
284284
const sortingData = plugin.determineAndPrepareSortingDataForFolder(folder)
285285

286286
if (sortingData.sortSpec) {
287-
if (!plugin.customSortAppliedAtLeastOnce) {
288-
plugin.customSortAppliedAtLeastOnce = true
289-
setTimeout(() => {
290-
plugin.setRibbonIconToEnabled.apply(plugin)
291-
plugin.showNotice('Custom sort APPLIED.');
292-
plugin.updateStatusBar()
293-
})
294-
}
295287
return getSortedFolderItems.call(this, folder, sortingData.sortSpec, plugin.createProcessingContextForSorting(sortingData.sortingAndGroupingStats))
296288
} else {
297289
return old.call(this, ...args);
@@ -346,6 +338,8 @@ export default class CustomSortPlugin
346338
this.customSortAppliedAtLeastOnce = false
347339
fileExplorer.view.requestSort();
348340
}
341+
this.setRibbonIconToEnabled()
342+
this.showNotice('Custom sort APPLIED.')
349343
} else {
350344
setIcon(this.ribbonIconEl, ICON_SORT_SUSPENDED_SYNTAX_ERROR)
351345
this.settings.suspended = true
@@ -713,7 +707,7 @@ export default class CustomSortPlugin
713707

714708
updateStatusBar() {
715709
if (this.statusBarItemEl) {
716-
let status = (!this.settings.suspended && this.customSortAppliedAtLeastOnce) ? 'ON' : 'OFF'
710+
let status = !this.settings.suspended ? 'ON' : 'OFF'
717711
this.statusBarItemEl.setText(`Custom sort:${status}`)
718712
}
719713
}

0 commit comments

Comments
 (0)