Skip to content

Commit 868a87c

Browse files
committed
Stop escape key from clearing the input. Non standard. Bad for vim people. Causes more harm than good
1 parent 4c92ca7 commit 868a87c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cli/src/utils/__tests__/keyboard-actions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ describe('resolveChatKeyboardAction', () => {
111111
})
112112

113113
describe('escape with input text', () => {
114-
test('escape with text clears input', () => {
114+
test('escape with text does NOT clear input (better UX)', () => {
115115
const state: ChatKeyboardState = {
116116
...defaultState,
117117
inputValue: 'hello world',
118118
}
119119
expect(resolveChatKeyboardAction(escapeKey, state)).toEqual({
120-
type: 'clear-input',
120+
type: 'none',
121121
})
122122
})
123123

cli/src/utils/keyboard-actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ export function resolveChatKeyboardAction(
142142
return { type: 'exit-input-mode' }
143143
}
144144

145-
// Priority 3: Clear input with escape/ctrl-c when there's text
146-
if ((isEscape || isCtrlC) && state.inputValue.trim().length > 0) {
145+
// Priority 3: Clear input with ctrl-c when there's text
146+
if (isCtrlC && state.inputValue.trim().length > 0) {
147147
return { type: 'clear-input' }
148148
}
149149

0 commit comments

Comments
 (0)