Commit f57a3c41 authored by LianaHus's avatar LianaHus

new function to switchToActive tab

parent 714165a2
......@@ -102,9 +102,7 @@ class FileManager extends Plugin {
closeFile (name) {
delete this.openedFiles[name]
if (Object.keys(this.openedFiles).length) {
this.switchFile(Object.keys(this.openedFiles)[0])
} else {
if (!Object.keys(this.openedFiles).length) {
this.editor.displayEmptyReadOnlySession()
this._deps.config.set('currentFile', '')
this.events.emit('noFileSelected')
......
......@@ -20,7 +20,6 @@ export class TabProxy {
fileManager.events.on('fileClosed', (name) => {
this.removeTab(name)
this.switchPreviousTab()
})
fileManager.events.on('currentFileChanged', (file) => {
......@@ -105,11 +104,19 @@ export class TabProxy {
const handlers = Object.keys(this._handlers)
let i = handlers.indexOf(active)
if (i >= 0) {
i = handlers[i - 1] ? i - 1 : handlers.length - 1
this.switchTab(handlers[i])
}
}
}
switchToActiveTab () {
const active = this._view.filetabs.active
if (active && this._handlers[active]) {
this.switchTab(active)
}
}
showTab (name) {
this._view.filetabs.activateTab(name)
}
......@@ -133,6 +140,7 @@ export class TabProxy {
removeTab (name) {
this._view.filetabs.removeTab(name)
delete this._handlers[name]
this.switchToActiveTab ()
}
addHandler (type, fn) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment