Merge branch 'master' of https://github.com/ethereum/remix-project into focustests

pull/2356/head
filip mertens 3 years ago
commit d913350d4a
  1. 2
      apps/remix-ide/src/app/files/fileManager.ts
  2. 14
      apps/remix-ide/src/app/panels/tab-proxy.js

@ -600,7 +600,7 @@ class FileManager extends Plugin {
// TODO: Only keep `this.emit` (issue#2210)
this.emit('fileRemoved', path)
this.events.emit('fileRemoved', path)
this.openFile()
this.openFile(this._deps.config.get('currentFile'))
}
async unselectCurrentFile() {

@ -41,7 +41,13 @@ export class TabProxy extends Plugin {
if (this.fileManager.mode === 'browser') {
name = name.startsWith(workspace + '/') ? name : workspace + '/' + name
this.removeTab(name)
// If deleted file is not current file and not an active tab in editor,
// ensure current file is active in the editor
if (this.fileManager.currentFile() && name !== this.fileManager.currentFile()) {
const currentFile = this.fileManager.currentFile()
const currentFileTabPath = currentFile.startsWith(workspace + '/') ? currentFile : workspace + '/' + currentFile
this.removeTab(name, { name: currentFileTabPath })
} else this.removeTab(name)
} else {
name = name.startsWith(this.fileManager.mode + '/') ? name : this.fileManager.mode + '/' + name
this.removeTab(name)
@ -261,11 +267,11 @@ export class TabProxy extends Plugin {
this._handlers[name] = { switchTo, close }
}
removeTab (name) {
removeTab (name, currentFileTab) {
delete this._handlers[name]
let previous = null
let previous = currentFileTab
this.loadedTabs = this.loadedTabs.filter((tab, index) => {
if (tab.name === name) previous = this.loadedTabs[index - 1]
if (!previous && tab.name === name) previous = this.loadedTabs[index - 1]
return tab.name !== name
})
this.renderComponent()

Loading…
Cancel
Save