Space presses form buttons, as the help says

Only the Test button turned Space into Enter; Save, Revert and the
buttons of the dialogs ignored it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
This commit is contained in:
2026-10-21 12:11:13 +02:00
co-authored by Claude Opus 5.5
parent 820b17842b
commit 24f7c38a5b
2 changed files with 13 additions and 0 deletions
+3
View File
@@ -44,6 +44,9 @@ func arrowNavigation(f *tview.Form, cancel func(), hooks *browseHooks) {
return ev return ev
} }
b.dd = nil b.dd = nil
if button >= 0 && ev.Key() == tcell.KeyRune && ev.Rune() == ' ' {
return tcell.NewEventKey(tcell.KeyEnter, 0, 0) // Space presses a button too
}
total := f.GetFormItemCount() + f.GetButtonCount() total := f.GetFormItemCount() + f.GetButtonCount()
pos := item pos := item
if button >= 0 { if button >= 0 {
+10
View File
@@ -48,6 +48,16 @@ func TestArrowNavigation(t *testing.T) {
if item, _ := f.GetFocusedItemIndex(); item != 1 { if item, _ := f.GetFocusedItemIndex(); item != 1 {
t.Fatalf("Up from first button: item %d, want 1", item) t.Fatalf("Up from first button: item %d, want 1", item)
} }
// Space on a button is Enter; on a checkbox it stays Space.
send(tcell.KeyDown)
if got := cap(tcell.NewEventKey(tcell.KeyRune, ' ', 0)); got == nil || got.Key() != tcell.KeyEnter {
t.Errorf("Space on a button: %v", got)
}
send(tcell.KeyUp)
if got := cap(tcell.NewEventKey(tcell.KeyRune, ' ', 0)); got == nil || got.Key() != tcell.KeyRune {
t.Errorf("Space on a checkbox: %v", got)
}
} }
func TestSearchNowFollowsMonitored(t *testing.T) { func TestSearchNowFollowsMonitored(t *testing.T) {