1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge pull request #468 from wtfutil/WTF-467-broken-help-display

Tabbing to widgets properly sets the IsFocused property. Closes #467
This commit is contained in:
Chris Cummer 2019-05-25 15:23:24 -07:00 committed by GitHub
commit 276e94a092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -10,7 +10,7 @@ import (
func (widget *Widget) initializeKeyboardControls() { func (widget *Widget) initializeKeyboardControls() {
widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt") widget.SetKeyboardChar("/", widget.ShowHelp, "Show/hide this help prompt")
widget.SetKeyboardChar(" ", widget.Refresh, "Refresh widget") widget.SetKeyboardChar("r", widget.Refresh, "Refresh widget")
widget.SetKeyboardChar("j", widget.displayNext, "Select next item") widget.SetKeyboardChar("j", widget.displayNext, "Select next item")
widget.SetKeyboardChar("k", widget.displayPrev, "Select previous item") widget.SetKeyboardChar("k", widget.displayPrev, "Select previous item")
widget.SetKeyboardChar(" ", widget.toggleChecked, "Toggle checkmark") widget.SetKeyboardChar(" ", widget.toggleChecked, "Toggle checkmark")

View File

@ -79,6 +79,8 @@ func (tracker *FocusTracker) Next() {
tracker.blur(tracker.Idx) tracker.blur(tracker.Idx)
tracker.increment() tracker.increment()
tracker.focus(tracker.Idx) tracker.focus(tracker.Idx)
tracker.IsFocused = true
} }
// None removes focus from the currently-focused widget. // None removes focus from the currently-focused widget.
@ -100,6 +102,8 @@ func (tracker *FocusTracker) Prev() {
tracker.blur(tracker.Idx) tracker.blur(tracker.Idx)
tracker.decrement() tracker.decrement()
tracker.focus(tracker.Idx) tracker.focus(tracker.Idx)
tracker.IsFocused = true
} }
func (tracker *FocusTracker) Refocus() { func (tracker *FocusTracker) Refocus() {