Skip to content

Commit facf223

Browse files
devvaannshabose
authored andcommitted
fix: scroll to active tab not working for image files
1 parent 88aa624 commit facf223

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/extensionsIntegrated/TabBar/overflow.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,23 @@ define(function (require, exports, module) {
254254
return;
255255
}
256256

257-
// make sure there is an active editor
257+
let activePath;
258+
259+
// get the active file
258260
const activeEditor = EditorManager.getActiveEditor();
259-
if (!activeEditor || !activeEditor.document || !activeEditor.document.file) {
260-
return;
261+
if (activeEditor && activeEditor.document && activeEditor.document.file) {
262+
activePath = activeEditor.document.file.fullPath;
263+
} else {
264+
// If there is no active editor, we need to check if its an image file
265+
const currentFile = MainViewManager.getCurrentlyViewedFile();
266+
if (currentFile) {
267+
activePath = currentFile.fullPath;
268+
} else {
269+
// if not an image file, not a text file, we don't need to scroll
270+
return;
271+
}
261272
}
262273

263-
const activePath = activeEditor.document.file.fullPath;
264274
// get the active tab. the active tab is the tab that is currently open
265275
const $activeTab = $tabBarElement.find(`.tab[data-path="${activePath}"]`);
266276

0 commit comments

Comments
 (0)