From c5cd80b4bed1234152f19d23ddac51d86ba36f0f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 8 Feb 2026 17:38:07 +0200 Subject: Fix Claude agent clearing to use readline instead of vim commands Claude Code's prompt input field does not support vim commands for clearing. The previous sequence 'Escape gg C-v G d i' resulted in literal text 'gGdijo' appearing in the prompt instead of clearing it. Changed to 'C-a C-k' (Emacs/readline style): - C-a: Move cursor to start of line - C-k: Kill (delete) from cursor to end of line Also added 150ms delay after Escape key in sendClearSequence to ensure mode transitions complete before subsequent keys are sent (though Claude uses readline, this helps other potential vim-based agents). Changes: - internal/tmuxedit/claude_agent.go: clearKeys "C-a C-k" instead of vim - internal/tmuxedit/claude_agent_test.go: Update test expectations - internal/tmuxedit/agentutil.go: Add time import and Escape delay - docs/usage.md: Update claude clear method documentation - docs/tmux.md: Clarify claude uses readline not vim - config.toml.example: Update claude description Integration tested: - Extracted: "final verification test" - Sent: "FINAL REPLACED TEXT NO VIM COMMANDS" - Result: Clean replacement with NO vim command artifacts - All unit tests pass (67/67) - Coverage: 80.9% Co-authored-by: Cursor --- docs/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/usage.md') diff --git a/docs/usage.md b/docs/usage.md index 8c2d0a6..387ad34 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -165,7 +165,7 @@ Built-in agent detection (auto-detected from pane content, checked in order): - Clears with: `End BSpace*200` (backspace method) - Prompt pattern: Extracts from last `│...│` box 2. **Claude Code** -- detects `❯` prompt symbol, "claude code", or "anthropic" - - Clears with: `Escape gg C-v G d i` (Vi/Vim style) + - Clears with: `C-a C-k` (Emacs/readline style) - Prompt pattern: Extracts from last section between `─────` rules 3. **Amp** -- detects "amp" or "sourcegraph" in pane (TUI mode) - Clears with: `C-u` (Emacs/readline style) -- cgit v1.2.3