Severity: MEDIUM Status: Fixed
parse splits the raw command line into argv with a bare space tokenizer and no quote or backslash handling:
// src/cmd/cmd.zig:1672-1687
pub fn parse(input: []const u8, allocator: std.mem.Allocator) !CmdArgs {
var arg_list: std.ArrayList([]const u8) = .empty;
var it = std.mem.tokenizeScalar(u8, input, ' ');
while (it.next()) |token| {
try arg_list.append(allocator, token);
}
// ...
}
bind-key C-a "send-keys C-a" becomes the token list ["bind-key", "C-a", "\"send-keys", "C-a\""] — the quotes are preserved literally and the grouping is lost.cmdBindKey then receives "send-keys as the command name (lookup fails) instead of the intended send-keys C-a target. Any command whose argument contains a space (run-shell, send-keys, etc.) is broken when quoted.bind-key, since every handler consumes the same args produced by parse.tmux’s command parser honors single/double quotes and backslash escapes so that "a b" is a single argument. szn’s parse implements none of this.
Replace the space tokenizer with a small argv splitter that tracks quote state (single/double) and processes \ escapes, producing one token per logical argument and stripping the surrounding quotes. Keep min_args/max_args validation as-is.