fix(ui): save notes from tmux Ctrl-S input#350
Conversation
Greptile SummaryFixes Ctrl-S note saving when tmux forwards keyboard input using CSI-u encoding (
Confidence Score: 4/5The change is safe to merge; the core CSI-u fix is correct and the new test exercises the added path end-to-end. The
Important Files Changed
Sequence DiagramsequenceDiagram
participant T as Terminal/tmux
participant AI as AgentInlineNote keyHandler
participant KS as useAppKeyboardShortcuts
participant TA as Textarea
T->>AI: KeyEvent (raw 0x13 or CSI-u)
AI->>AI: isSaveDraftNoteKey check
alt Ctrl-S recognized in component
AI->>AI: preventDefault + stopPropagation
AI->>AI: draft.onSave()
note over TA: event never reaches textarea
else Escape in component
AI->>AI: preventDefault + stopPropagation
AI->>AI: draft.onCancel()
else other key
AI->>KS: propagate
KS->>KS: isSaveDraftNoteKey check
alt Ctrl-S in app shortcuts
KS->>KS: consumeKey + saveDraftNote
else Escape in app shortcuts
KS->>KS: consumeKey + cancelDraftNote
else other
KS->>TA: propagate to textarea
end
end
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/ui/lib/keyboard.ts:28-29
`CTRL_S_HEX_LABEL` matches the literal 4-character ASCII string `"0x13"`, not the control character. The control character (`\u0013`) is already matched by `CTRL_S` on lines 24–25, so these two clauses are dead code unless some terminal or tmux mode actually emits the text string `"0x13"` as a key sequence. If no such encoding exists, these lines should be removed to avoid confusion; if they were added to handle a specific case, a comment explaining which encoding produces this string would prevent the next reader from assuming it is a typo.
Reviews (1): Last reviewed commit: "fix(ui): save notes from tmux Ctrl-S inp..." | Re-trigger Greptile |
| sequence === CTRL_S_HEX_LABEL || | ||
| raw === CTRL_S_HEX_LABEL |
There was a problem hiding this comment.
CTRL_S_HEX_LABEL matches the literal 4-character ASCII string "0x13", not the control character. The control character (\u0013) is already matched by CTRL_S on lines 24–25, so these two clauses are dead code unless some terminal or tmux mode actually emits the text string "0x13" as a key sequence. If no such encoding exists, these lines should be removed to avoid confusion; if they were added to handle a specific case, a comment explaining which encoding produces this string would prevent the next reader from assuming it is a typo.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/ui/lib/keyboard.ts
Line: 28-29
Comment:
`CTRL_S_HEX_LABEL` matches the literal 4-character ASCII string `"0x13"`, not the control character. The control character (`\u0013`) is already matched by `CTRL_S` on lines 24–25, so these two clauses are dead code unless some terminal or tmux mode actually emits the text string `"0x13"` as a key sequence. If no such encoding exists, these lines should be removed to avoid confusion; if they were added to handle a specific case, a comment explaining which encoding produces this string would prevent the next reader from assuming it is a typo.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good catch — the literal 0x13 fallback was speculative and not backed by the tmux smoke test. I removed it, leaving only raw Ctrl-S and CSI-u handling.
This comment was generated by Pi using OpenAI GPT-5 Codex
Summary
Fixes #345
Testing
C-ssaved a draft note without inserting0x13ESC [ 115 ; 5 usaved a draft note without inserting0x13or115;5uThis PR description was generated by Pi using OpenAI GPT-5 Codex