From f0f734de0a58ca48e559e1091329ec7fad7112c5 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 19 Mar 2026 21:19:36 -0700 Subject: [PATCH 1/2] feat(dialog): show tab name in close tab confirmation Include the panel's custom title, terminal title, or directory name in the close tab confirmation dialog's informative text so users know which tab will be closed. Falls back to the generic message when no name is available. The dialog title stays "Close tab?" for consistency with the close-confirmation detection in AppDelegate. Fixes #1603 Co-Authored-By: Claude Opus 4.6 --- Sources/Workspace.swift | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Sources/Workspace.swift b/Sources/Workspace.swift index b2c0ca68..4de67906 100644 --- a/Sources/Workspace.swift +++ b/Sources/Workspace.swift @@ -9017,8 +9017,28 @@ extension Workspace: BonsplitDelegate { @MainActor private func confirmClosePanel(for tabId: TabID) async -> Bool { let alert = NSAlert() + alert.messageText = String(localized: "dialog.closeTab.title", defaultValue: "Close tab?") - alert.informativeText = String(localized: "dialog.closeTab.message", defaultValue: "This will close the current tab.") + + let panelName: String? = { + guard let panelId = panelIdFromSurfaceId(tabId) else { return nil } + if let custom = panelCustomTitles[panelId], !custom.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + return custom + } + if let title = panelTitles[panelId], !title.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + return title + } + if let dir = panelDirectories[panelId], !dir.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + return (dir as NSString).lastPathComponent + } + return nil + }() + + if let panelName { + alert.informativeText = String(localized: "dialog.closeTab.messageNamed", defaultValue: "This will close \"\(panelName)\".") + } else { + alert.informativeText = String(localized: "dialog.closeTab.message", defaultValue: "This will close the current tab.") + } alert.alertStyle = .warning alert.addButton(withTitle: String(localized: "dialog.closeTab.close", defaultValue: "Close")) alert.addButton(withTitle: String(localized: "dialog.closeTab.cancel", defaultValue: "Cancel")) From 7a121738d7b24e28503347db711fa2024cb6ada1 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 19 Mar 2026 21:33:05 -0700 Subject: [PATCH 2/2] fix: add dialog.closeTab.messageNamed to Localizable.xcstrings Add English and Japanese translations for the named tab close confirmation message. Uses %@ format specifier for the tab name to support proper localization word order. Co-Authored-By: Claude Opus 4.6 --- Resources/Localizable.xcstrings | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 157ff49a..ebf35345 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -29616,6 +29616,23 @@ } } }, + "dialog.closeTab.messageNamed": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "This will close \"%@\"." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "「%@」を閉じます。" + } + } + } + }, "dialog.closeTab.title": { "extractionState": "manual", "localizations": {