From d920375e5e4a79ce29fc49e9f1c67c7b8e7a0bb9 Mon Sep 17 00:00:00 2001 From: Codeman maintainer Date: Sat, 24 Oct 2026 14:37:05 +0200 Subject: [PATCH] fix: address the release-prep review of #677 test: record sendInput('-x hello') and sendInput('-\r') and check the shell argv ends -l -- on both send-keys -l branches Co-Authored-By: Claude Opus 5.5 (1M context) --- test/tmux-submit-paste.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/tmux-submit-paste.test.ts b/test/tmux-submit-paste.test.ts index 7cc04b7f..e0a3fa88 100644 --- a/test/tmux-submit-paste.test.ts +++ b/test/tmux-submit-paste.test.ts @@ -293,4 +293,21 @@ describe('sendInput line breaks', () => { expect(typed.ran).toHaveLength(1); expect(typed.ran[0]).toMatch(/ send-keys -t "codeman-abc12345" -l -- 'just type'$/); }); + + // The argv a shell hands tmux must put `--` right before the text, or tmux reads + // a leading `-` as its own option and types nothing. + it('types text that starts with a hyphen after --, on both send-keys -l branches', async () => { + const keysArgv = (cmd: string) => argvOf(cmd.replace(/^.*? send-keys /, `${FAKE_TMUX} send-keys `)); + + const typed = managerWithSession(); + await typed.sendInput('s1', '-x hello'); + expect(typed.ran).toHaveLength(1); + expect(keysArgv(typed.ran[0]).slice(-3)).toEqual(['-l', '--', '-x hello']); + + const answer = managerWithSession(); + await answer.sendInput('s1', '-\r'); + expect(answer.ran).toHaveLength(2); + expect(keysArgv(answer.ran[0]).slice(-3)).toEqual(['-l', '--', '-']); + expect(answer.ran[1]).toMatch(/ send-keys -t "codeman-abc12345" Enter$/); + }); });