mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Renormalize the redraw function
Have all instances take a function Update the remaining modules to take this into account Numerous smaller refactors to make some widgets work more or less the same
This commit is contained in:
@@ -72,8 +72,8 @@ func (widget *ScrollableWidget) Unselect() {
|
||||
}
|
||||
}
|
||||
|
||||
func (widget *ScrollableWidget) Redraw(title, content string, wrap bool) {
|
||||
widget.TextWidget.Redraw(title, content, wrap)
|
||||
func (widget *ScrollableWidget) Redraw(data func() (string, string, bool)) {
|
||||
widget.TextWidget.Redraw(data)
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.View.Highlight(strconv.Itoa(widget.Selected)).ScrollToHighlight()
|
||||
})
|
||||
|
||||
@@ -29,16 +29,7 @@ func (widget *TextWidget) TextView() *tview.TextView {
|
||||
return widget.View
|
||||
}
|
||||
|
||||
func (widget *TextWidget) Redraw(title, text string, wrap bool) {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
widget.View.Clear()
|
||||
widget.View.SetWrap(wrap)
|
||||
widget.View.SetTitle(widget.ContextualTitle(title))
|
||||
widget.View.SetText(text)
|
||||
})
|
||||
}
|
||||
|
||||
func (widget *TextWidget) RedrawFunc(data func() (string, string, bool)) {
|
||||
func (widget *TextWidget) Redraw(data func() (string, string, bool)) {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
title, content, wrap := data()
|
||||
widget.View.Clear()
|
||||
|
||||
Reference in New Issue
Block a user