fix: allow closing last session tab and restore DevTools shortcut

Closing the sole remaining non-welcome tab now resets to welcome; enable Tauri devtools, menu/shortcut toggle, and copy release artifacts from CARGO_TARGET_DIR.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Logan.LiandCursor committed 2026-08-12 01:31:20 +08:00
1 parent da95113e6d
commit 188f3556ed
14 files changed
+95 -38

No files matched your search

+18 -5
View File
@@ -176,12 +176,25 @@ export const useTabStore = create<TabState>()(
closeTab: (tabId) => {
const { tabs, activeTabId } = get()
if (tabs.length <= 1) return null
const closedTab = tabs.find(t => t.id === tabId) || null
if (!closedTab) return null
// Last remaining tab: welcome stays put; any other type resets to welcome
// (e.g. after "close others", closing the sole terminal must work).
if (tabs.length <= 1) {
if (closedTab.type === 'welcome') return null
const welcomeTab: Tab = {
id: 'welcome',
title: '欢迎',
type: 'welcome',
isActive: true,
}
set({ tabs: [welcomeTab], activeTabId: 'welcome' })
return closedTab
}
const newTabs = tabs.filter(t => t.id !== tabId)
// If closing active tab, activate another one
let newActiveId = activeTabId
if (activeTabId === tabId) {
@@ -192,7 +205,7 @@ export const useTabStore = create<TabState>()(
newActiveId = newActiveTab.id
}
}
set({ tabs: newTabs, activeTabId: newActiveId })
return closedTab
},