Merge pull request #2464 from ethereum/fixTabSwitch

select next tab if previous is not available
pull/5370/head
yann300 3 years ago committed by GitHub
commit 4a2afd70ca
  1. 15
      apps/remix-ide/src/app/editor/editor.js
  2. 3
      apps/remix-ide/src/app/panels/layout.ts
  3. 7
      apps/remix-ide/src/app/panels/tab-proxy.js

@ -141,12 +141,6 @@ class Editor extends Plugin {
this.on('sidePanel', 'pluginDisabled', (name) => {
this.clearAllDecorationsFor(name)
})
this.on('fileManager', 'fileClosed', (name) => {
if (name === this.currentFile) {
this.currentFile = null
this.renderComponent()
}
})
this.on('theme', 'themeLoaded', (theme) => {
this.currentThemeType = theme.quality
this.renderComponent()
@ -171,6 +165,15 @@ class Editor extends Plugin {
}
}
}
if (name === this.currentFile) {
this.currentFile = name
this.renderComponent()
}
})
this.on('fileManager', 'noFileSelected', async () => {
this.currentFile = null
this.renderComponent()
})
try {
this.currentThemeType = (await this.call('theme', 'currentTheme')).quality

@ -57,9 +57,6 @@ export class Layout extends Plugin {
this.panels.main.active = false
this.event.emit('change', null)
})
this.on('tabs', 'tabCountChanged', async count => {
if (!count) await this.call('manager', 'activatePlugin', 'home')
})
this.on('manager', 'activate', (profile: Profile) => {
switch (profile.name) {
case 'filePanel':

@ -283,7 +283,12 @@ export class TabProxy extends Plugin {
delete this._handlers[name]
let previous = currentFileTab
this.loadedTabs = this.loadedTabs.filter((tab, index) => {
if (!previous && tab.name === name) previous = this.loadedTabs[index - 1]
if (!previous && tab.name === name) {
if(index - 1 >= 0 && this.loadedTabs[index - 1])
previous = this.loadedTabs[index - 1]
else if (index + 1 && this.loadedTabs[index + 1])
previous = this.loadedTabs[index + 1]
}
return tab.name !== name
})
this.renderComponent()

Loading…
Cancel
Save