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:
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func (widget *Widget) initializeKeyboardControls() {
|
||||
widget.InitializeCommonControls(widget.Refresh)
|
||||
widget.InitializeRefreshKeyboardControl(widget.Refresh)
|
||||
|
||||
widget.SetKeyboardChar("j", widget.Next, "Select next item")
|
||||
widget.SetKeyboardChar("k", widget.Prev, "Select previous item")
|
||||
|
||||
@@ -15,7 +15,6 @@ type ContentItem struct {
|
||||
|
||||
type Widget struct {
|
||||
view.MultiSourceWidget
|
||||
view.KeyboardWidget
|
||||
view.TextWidget
|
||||
|
||||
GitlabProjects []*GitlabProject
|
||||
@@ -34,9 +33,8 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
context, err := newContext(settings)
|
||||
|
||||
widget := Widget{
|
||||
KeyboardWidget: view.NewKeyboardWidget(app, pages, settings.common),
|
||||
MultiSourceWidget: view.NewMultiSourceWidget(settings.common, "repository", "repositories"),
|
||||
TextWidget: view.NewTextWidget(app, settings.common),
|
||||
TextWidget: view.NewTextWidget(app, pages, settings.common),
|
||||
|
||||
context: context,
|
||||
settings: settings,
|
||||
@@ -48,7 +46,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
|
||||
widget.initializeKeyboardControls()
|
||||
widget.View.SetRegions(true)
|
||||
widget.View.SetInputCapture(widget.InputCapture)
|
||||
widget.SetDisplayFunction(widget.display)
|
||||
|
||||
widget.Unselect()
|
||||
@@ -73,10 +70,6 @@ func (widget *Widget) Refresh() {
|
||||
widget.display()
|
||||
}
|
||||
|
||||
func (widget *Widget) HelpText() string {
|
||||
return widget.KeyboardWidget.HelpText()
|
||||
}
|
||||
|
||||
// SetItemCount sets the amount of PRs RRs and other PRs throughout the widgets display creation
|
||||
func (widget *Widget) SetItemCount(items int) {
|
||||
widget.maxItems = items
|
||||
|
||||
Reference in New Issue
Block a user