mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-30 16:39:33 +01:00
fix(tmux): read a one-binding key table from the full listing
A tmux built from master (`tmux -V`: next-3.7) prints nothing, exit 0, for `list-keys -T <table>` when the table holds exactly one binding. tmux 3.4 prints the line. One binding is the shape restrictTmuxPrefixTable leaves behind (`<prefix> send-prefix`), so on that tmux the reduced table read as needing a reset and every session create reset it again. `codeman tui` read its prefix table the same way, so readPrefixBinding called a bound key free and readDetachKey found no detach key. A blank answer is now read from the full `list-keys` listing, keeping only that table's lines. The parsers already match on `-T <table>`. Tests: recorded-command cases for the blank answer (reduced table kept, stray binding still reset) and TuiClient cases for both reads. The real-tmux helper reads tables through the same fallback, and the escaped `C-\` check accepts the unescaped form the full listing prints.
This commit is contained in:
1 parent
e99b42c387
commit
c497869ee5
6 files changed
+111
-9
No files matched your search
@@ -153,6 +153,16 @@ export function restrictTmuxPrefixTable(tmux: string, run: TmuxRunner = defaultR
|
||||
let listing: string | null;
|
||||
try {
|
||||
listing = run(`${tmux} list-keys -T prefix`);
|
||||
// ⚠️ Some tmux builds (a `next-3.7` development build) print NOTHING for
|
||||
// `list-keys -T prefix` when the table holds exactly one binding, which is the
|
||||
// shape this function leaves behind: read blank as "ask the full listing" and keep
|
||||
// only its prefix-table lines, or every call would reset an already-reduced table.
|
||||
if (!listing.trim()) {
|
||||
listing = run(`${tmux} list-keys`)
|
||||
.split('\n')
|
||||
.filter((line) => PREFIX_LINE.test(line.trim()))
|
||||
.join('\n');
|
||||
}
|
||||
} catch {
|
||||
listing = null; // an empty table makes list-keys fail on some tmux builds
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user