fix(tmux): bind nested prefix before unbind so an empty table cannot abort the chain

A user tmux config that leaves the prefix table empty makes
unbind-key -a -T prefix fail and drop later commands in the \; chain,
including send-prefix and remain-on-exit failed. Bind C-q send-prefix,
clear the table, then bind it again.

Also accept macOS ttys in the TUI switch-guard test without reading
/proc, and describe the client_pid hook escape as defensive on tmux 3.4.

Co-authored-by: DDT <1786035110@qq.com>
This commit is contained in:
DDTandDDT committed 2026-10-23 09:08:48 +00:00
1 parent daeea54495
commit 9fc2773176
10 files changed
+106 -28

No files matched your search

+5 -3
View File
@@ -491,9 +491,11 @@ export function tuiSwitchGuard(tty: string): string {
}
/**
* `set-hook` command for `TUI_SWITCH_ATTACH_HOOK`. `\#{client_pid}` is deferred
* so tmux expands it when the hook fires, not when the hook is stored (a bare
* `#{client_pid}` is expanded at `set-hook` time, in no client, and stored empty).
* `set-hook` command for `TUI_SWITCH_ATTACH_HOOK`. `\#{client_pid}` is
* defensive. On tmux 3.4 both this form and a bare `#{client_pid}` are stored
* verbatim and both record the attaching client's pid. The escape stays so a
* tmux that expands formats while the hook is stored (no client exists yet)
* cannot save an empty pid.
*/
export function tuiSwitchAttachHook(tty: string): string {
return (