Add the Config view: edit and save the settings, applied without a restart
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -51,9 +51,24 @@ func arrowNavigation(f *tview.Form, cancel func(), hooks *browseHooks) {
|
||||
}
|
||||
switch ev.Key() {
|
||||
case tcell.KeyDown:
|
||||
if pos == total-1 && hooks != nil && hooks.edge != nil && hooks.edge(true) {
|
||||
return nil
|
||||
}
|
||||
f.SetFocus(min(pos+1, total-1))
|
||||
case tcell.KeyUp:
|
||||
if pos == 0 && hooks != nil && hooks.edge != nil && hooks.edge(false) {
|
||||
return nil
|
||||
}
|
||||
f.SetFocus(max(pos-1, 0))
|
||||
case tcell.KeyTab, tcell.KeyBacktab:
|
||||
dir := 1
|
||||
if ev.Key() == tcell.KeyBacktab {
|
||||
dir = -1
|
||||
}
|
||||
if hooks != nil && hooks.tab != nil && hooks.tab(dir) {
|
||||
return nil
|
||||
}
|
||||
return ev
|
||||
case tcell.KeyLeft, tcell.KeyRight:
|
||||
step := 1
|
||||
if ev.Key() == tcell.KeyLeft {
|
||||
@@ -118,6 +133,11 @@ func bindSearchNow(box *tview.Checkbox, searchable func() bool, blocked func())
|
||||
type browseHooks struct {
|
||||
browse func(dd *tview.DropDown, index int) // the highlight moved to entry index
|
||||
abort func() // the list was closed without selecting
|
||||
// edge is called when Down is pressed on the last field or Up on the first;
|
||||
// it returns true if it moved the focus elsewhere.
|
||||
edge func(down bool) bool
|
||||
// tab is called for Tab (dir 1) and Shift+Tab (dir -1); true if handled.
|
||||
tab func(dir int) bool
|
||||
}
|
||||
|
||||
// browser mirrors the highlight of an open dropdown list, which tview does
|
||||
|
||||
Reference in New Issue
Block a user