Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/roborev/tui/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (m model) handleMouseMsg(msg tea.MouseMsg) (tea.Model, tea.Cmd) {
// handleGlobalKey handles keys shared across queue, review, prompt, commit msg, and help views.
func (m model) handleGlobalKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c", "q":
case "ctrl+c", "ctrl+d", "q":
return m.handleQuitKey()
case "home", "g":
return m.handleHomeKey()
Expand Down
8 changes: 4 additions & 4 deletions cmd/roborev/tui/handlers_modal.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (m model) handleLogKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c":
return m, tea.Quit
case "esc", "q":
case "ctrl+d", "esc", "q":
m.currentView = m.logFromView
m.logStreaming = false
return m, nil
Expand Down Expand Up @@ -329,7 +329,7 @@ func (m model) handleWorktreeConfirmKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c":
return m, tea.Quit
case "esc", "n":
case "ctrl+d", "esc", "n":
m.currentView = viewTasks
m.worktreeConfirmJobID = 0
m.worktreeConfirmBranch = ""
Expand All @@ -347,7 +347,7 @@ func (m model) handleWorktreeConfirmKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
// handleTasksKey handles key input in the tasks view.
func (m model) handleTasksKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c", "q":
case "ctrl+c", "ctrl+d", "q":
return m, tea.Quit
case "esc", "T":
m.currentView = viewQueue
Expand Down Expand Up @@ -504,7 +504,7 @@ func (m model) handlePatchKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "ctrl+c":
return m, tea.Quit
case "esc", "q":
case "ctrl+d", "esc", "q":
m.currentView = viewTasks
m.patchText = ""
m.patchScroll = 0
Expand Down
2 changes: 1 addition & 1 deletion cmd/roborev/tui/handlers_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (m model) handleColumnOptionsInput(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
}

switch msg.String() {
case "esc":
case "ctrl+d", "esc":
m.currentView = m.colOptionsReturnView
if m.colOptionsDirty {
m.colOptionsDirty = false
Expand Down
44 changes: 44 additions & 0 deletions cmd/roborev/tui/review_views_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,50 @@ func TestTUICommitMsgViewNavigationWithQ(t *testing.T) {
}
}

func TestTUICtrlDQuitsFromQueueView(t *testing.T) {
m := initTestModel(withCurrentView(viewQueue))

_, cmd := pressSpecial(m, tea.KeyCtrlD)

if cmd == nil {
t.Fatal("Expected quit command")
}
assertMsgType[tea.QuitMsg](t, cmd())
}

func TestTUICtrlDNavigatesBackFromReviewView(t *testing.T) {
job := makeJob(1)
m := initTestModel(
withCurrentView(viewReview),
withReview(&storage.Review{JobID: 1, Job: &job}),
withReviewFromView(viewQueue),
)

got, _ := pressSpecial(m, tea.KeyCtrlD)

assertView(t, got, viewQueue)
}

func TestTUICtrlDNoOpInCommentModal(t *testing.T) {
m := initTestModel(withCurrentView(viewKindComment))
m.commentFromView = viewQueue
m.commentText = "draft comment"
m.commentJobID = 42

got, cmd := pressSpecial(m, tea.KeyCtrlD)

assertView(t, got, viewKindComment)
if got.commentText != "draft comment" {
t.Errorf("Expected comment text preserved, got %q", got.commentText)
}
if got.commentJobID != 42 {
t.Errorf("Expected comment job ID preserved, got %d", got.commentJobID)
}
if cmd != nil {
t.Fatal("Expected no command from Ctrl-D in comment modal")
}
}

func TestFetchCommitMsgJobTypeDetection(t *testing.T) {
// Test that fetchCommitMsg correctly identifies job types and returns appropriate errors
// This is critical: Prompt field is populated for ALL jobs (stores review prompt),
Expand Down
Loading