Skip to content

Commit c36f20d

Browse files
cpcloudcursoragent
andcommitted
refactor(ui): remove q key for quit, use only ctrl+q
Removed the 'q' key as a quit option, making ctrl+q the only way to exit the application. This prevents accidental quits and simplifies the key binding model. Changes: - Removed "q" handler from handleNormalSwitch in model.go - Updated status bar hint to show "ctrl+q" instead of "q" - Updated help overlay to show only "ctrl+q" for quit - Updated tests to reflect that 'q' no longer quits Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 16142b7 commit c36f20d

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

internal/app/inline_input_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ func TestInlineInputAbsorbsKeys(t *testing.T) {
4747
showHouseBefore := m.showHouse
4848
sendKey(m, "tab")
4949
assert.Equal(t, showHouseBefore, m.showHouse, "tab should be absorbed by inline input")
50-
51-
// 'q' should not quit -- inline input should still be active.
52-
sendKey(m, "q")
53-
assert.NotNil(t, m.inlineInput, "inline input should still be active after pressing q")
5450
}
5551

5652
func TestInlineInputTypingUpdatesValue(t *testing.T) {

internal/app/mode_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ func TestNextTabAdvances(t *testing.T) {
164164
func TestQuitOnlyInNormalMode(t *testing.T) {
165165
m := newTestModel()
166166

167-
// In edit mode, 'q' should not quit (no cmd returned).
167+
// In edit mode, 'ctrl+q' should quit (returns tea.Quit).
168168
sendKey(m, "i")
169-
_, cmd := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("q")})
170-
assert.Nil(t, cmd, "'q' should not produce a command in edit mode")
169+
_, cmd := m.Update(tea.KeyMsg{Type: tea.KeyCtrlQ})
170+
assert.NotNil(t, cmd, "'ctrl+q' should quit even in edit mode")
171171
}
172172

173173
func TestIKeyDoesNothingInEditMode(t *testing.T) {
@@ -286,8 +286,6 @@ func TestHelpAbsorbsOtherKeys(t *testing.T) {
286286
require.NotNil(t, m.helpViewport, "expected help visible")
287287

288288
// Keys that would normally affect the model should be absorbed.
289-
sendKey(m, "q")
290-
assert.NotNil(t, m.helpViewport, "help should absorb 'q' without quitting")
291289
sendKey(m, "i")
292290
assert.Equal(t, modeNormal, m.mode, "'i' should not switch to edit mode while help is open")
293291
}

internal/app/model.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,6 @@ func (m *Model) handleNormalKeys(key tea.KeyMsg) (tea.Cmd, bool) {
475475
case "@":
476476
m.openChat()
477477
return nil, true
478-
case "q":
479-
return tea.Quit, true
480478
case keyEsc:
481479
if m.inDetail() {
482480
m.closeDetail()

internal/app/view.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ func (m *Model) normalModeStatusHints(modeBadge string) []statusHint {
441441
} else {
442442
hints = append(hints, statusHint{
443443
id: "exit",
444-
full: m.helpItem("q", "quit"),
445-
compact: m.renderKeys("q"),
444+
full: m.helpItem("ctrl+q", "quit"),
445+
compact: m.renderKeys("ctrl+q"),
446446
priority: 0,
447447
required: true,
448448
})
@@ -776,7 +776,7 @@ func (m *Model) helpContent() string {
776776
{"@", "Ask LLM"},
777777
{"i", "Edit mode"},
778778
{"?", "Help"},
779-
{"q / ctrl+q", "Quit"},
779+
{"ctrl+q", "Quit"},
780780
},
781781
},
782782
{

0 commit comments

Comments
 (0)