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

Make every widget a keyboard widget

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer
2020-11-26 02:10:21 -08:00
parent 2430fe9f56
commit 4a820dd0e5
112 changed files with 225 additions and 401 deletions

View File

@@ -7,7 +7,7 @@ import (
)
func (widget *Widget) initializeKeyboardControls() {
widget.InitializeCommonControls(widget.Refresh)
widget.InitializeRefreshKeyboardControl(widget.Refresh)
widget.SetKeyboardChar("h", widget.selectPrevious, "Select previous item")
widget.SetKeyboardChar("l", widget.selectNext, "Select next item")

View File

@@ -32,7 +32,6 @@ type Info struct {
// Widget is the struct used by all WTF widgets to transfer to the main widget controller
type Widget struct {
view.KeyboardWidget
view.TextWidget
Info
@@ -72,8 +71,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
var playerState *spotify.PlayerState
widget := Widget{
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
TextWidget: view.NewTextWidget(app, settings.common),
TextWidget: view.NewTextWidget(app, pages, settings.common),
Info: Info{},
@@ -124,7 +122,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
widget.settings.common.RefreshInterval = 5
widget.initializeKeyboardControls()
widget.View.SetInputCapture(widget.InputCapture)
widget.View.SetWrap(true)
widget.View.SetWordWrap(true)
@@ -165,10 +162,6 @@ func (w *Widget) Refresh() {
w.Redraw(w.createOutput)
}
func (widget *Widget) HelpText() string {
return widget.KeyboardWidget.HelpText()
}
func (w *Widget) createOutput() (string, string, bool) {
var output string