From b1e671f35b15e3c36127a4e32a566734359659bd Mon Sep 17 00:00:00 2001 From: mdwriter-09idI Date: Sat, 4 Nov 2023 17:41:51 +0800 Subject: [PATCH] fix: Selecting a tab to change the window name is invalid --- src/renderer/src/store/tree.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/store/tree.ts b/src/renderer/src/store/tree.ts index d854d5f8..1091b4b8 100644 --- a/src/renderer/src/store/tree.ts +++ b/src/renderer/src/store/tree.ts @@ -319,8 +319,7 @@ export class TreeStore { if (!treeStore.currentTab.current || this.tabs.length === 1) { const first = this.firstNote if (first) { - this.currentTab.history.push(first) - this.currentTab.index = 0 + this.openNote(first) this.openParentDir(first.filePath) } } @@ -469,6 +468,9 @@ export class TreeStore { selection.removeAllRanges() selection.addRange(backRange) } + if (this.openedNote) { + document.title = this.root ? `${basename(this.root.filePath)}-${basename(this.openedNote.filePath)}` : basename(this.openedNote.filePath) + } }) this.recordTabs() }