fix(ui): handle table wraparound on k binding
Some checks are pending
ci-build / lint (push) Waiting to run
ci-build / build (push) Blocked by required conditions
ci-build / release (push) Blocked by required conditions

This commit is contained in:
Rob Watson 2025-04-10 07:36:57 +02:00
parent 08a5690d30
commit 045498a2ce

View File

@ -293,6 +293,13 @@ func (ui *UI) inputCaptureHandler(event *tcell.EventKey) *tcell.EventKey {
return event return event
} }
handleKeyUp := func() {
row, _ := ui.destView.GetSelection()
if row == 1 {
ui.destView.Select(ui.destView.GetRowCount(), 0)
}
}
switch event.Key() { switch event.Key() {
case tcell.KeyRune: case tcell.KeyRune:
switch event.Rune() { switch event.Rune() {
@ -307,15 +314,14 @@ func (ui *UI) inputCaptureHandler(event *tcell.EventKey) *tcell.EventKey {
ui.copyConfigFilePathToClipboard(ui.clipboardAvailable, ui.configFilePath) ui.copyConfigFilePathToClipboard(ui.clipboardAvailable, ui.configFilePath)
case '?': case '?':
ui.showAbout() ui.showAbout()
case 'k': // tview vim bindings
handleKeyUp()
} }
case tcell.KeyDelete, tcell.KeyBackspace, tcell.KeyBackspace2: case tcell.KeyDelete, tcell.KeyBackspace, tcell.KeyBackspace2:
ui.removeDestination() ui.removeDestination()
return nil return nil
case tcell.KeyUp: case tcell.KeyUp:
row, _ := ui.destView.GetSelection() handleKeyUp()
if row == 1 {
ui.destView.Select(ui.destView.GetRowCount(), 0)
}
} }
return event return event