From 5f5c81d178bea44cb0007f941d8372604b4f2eb9 Mon Sep 17 00:00:00 2001 From: chris ha Date: Thu, 5 Nov 2026 17:09:50 +0000 Subject: [PATCH] Fix Esc close on the last tab: build the Ctrl+W byte at runtime in AppleScript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit perform action "text:\x11" never compiled — AppleScript rejects the literal backslash escape in a string (syntax error -2741), so the last-tab close always fell through to close-tab and left an empty New-tab page. The action now builds the byte with (ASCII character 17), which Ghostty accepts and sends as Ctrl+W, driving the browser's own closeOrShutdown so the pane exits cleanly. Verified against the running Ghostty: bogus actions return false, text:abc returns true, and the concatenated form returns true. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- src/reader/browser.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reader/browser.rs b/src/reader/browser.rs index cb72e32..c2bc90e 100644 --- a/src/reader/browser.rs +++ b/src/reader/browser.rs @@ -187,7 +187,9 @@ async fn close_pane(target: &Target) -> Result<()> { "-e", "set browserTerminal to first terminal whose id is item 1 of argv", "-e", - "return perform action \"text:\\x11\" on browserTerminal", + // AppleScript rejects a literal \x11 in a string (syntax error + // -2741), so build the Ctrl+W byte at runtime instead. + "return perform action (\"text:\" & (ASCII character 17)) on browserTerminal", "-e", "end tell", "-e",