Commit 690a86a1 authored by ioedeveloper's avatar ioedeveloper

Display least path difference in title of tabs

parent 8c4c4b9e
...@@ -159,13 +159,18 @@ export class TabProxy { ...@@ -159,13 +159,18 @@ export class TabProxy {
const duplicateTabName = this.loadedTabs.find(({ title }) => title === formatPath.join('/')).name const duplicateTabName = this.loadedTabs.find(({ title }) => title === formatPath.join('/')).name
const duplicateTabPath = duplicateTabName.split('/') const duplicateTabPath = duplicateTabName.split('/')
const duplicateTabFormatPath = [...duplicateTabPath].reverse() const duplicateTabFormatPath = [...duplicateTabPath].reverse()
const duplicateTab = document.querySelector(`[title="${duplicateTabName}"] > span`) const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/')
const duplicateTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/')
duplicateTab.innerHTML = duplicateTitle
this.loadedTabs.push({ this.loadedTabs.push({
name: duplicateTabName, name: duplicateTabName,
title: duplicateTitle title: duplicateTabTitle
})
this._view.filetabs.removeTab(duplicateTabName)
this._view.filetabs.addTab({
id: duplicateTabName,
title: duplicateTabTitle,
icon,
tooltip: duplicateTabName
}) })
} }
break; break;
...@@ -192,6 +197,7 @@ export class TabProxy { ...@@ -192,6 +197,7 @@ export class TabProxy {
this._view.filetabs.removeTab(name) this._view.filetabs.removeTab(name)
delete this._handlers[name] delete this._handlers[name]
this.switchToActiveTab() this.switchToActiveTab()
this.loadedTabs = this.loadedTabs.filter(tab => tab.name !== name)
} }
addHandler (type, fn) { 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