mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add a global Redraw method for TextWidget
Partially addresses #429, by centralizing widget drawing
This commit is contained in:
@@ -17,7 +17,6 @@ func (widget *Widget) display() {
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("[green]%s[white]", proj.Project.Name)
|
||||
widget.View.SetTitle(widget.ContextualTitle(title))
|
||||
|
||||
_, _, width, _ := widget.View.GetRect()
|
||||
str := widget.settings.common.SigilStr(len(widget.projects), widget.idx, width) + "\n"
|
||||
@@ -47,5 +46,5 @@ func (widget *Widget) display() {
|
||||
str = str + row + wtf.PadRow((checkWidth+len(item.Content)), (checkWidth+maxLen+1)) + "\n"
|
||||
}
|
||||
|
||||
widget.View.SetText(str)
|
||||
widget.TextWidget.Redraw(title, str, false)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ type Widget struct {
|
||||
wtf.KeyboardWidget
|
||||
wtf.TextWidget
|
||||
|
||||
app *tview.Application
|
||||
idx int
|
||||
projects []*Project
|
||||
settings *Settings
|
||||
@@ -44,7 +43,6 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
KeyboardWidget: wtf.NewKeyboardWidget(),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
}
|
||||
|
||||
@@ -96,9 +94,7 @@ func (w *Widget) Refresh() {
|
||||
return
|
||||
}
|
||||
|
||||
w.app.QueueUpdateDraw(func() {
|
||||
w.display()
|
||||
})
|
||||
w.display()
|
||||
}
|
||||
|
||||
/* -------------------- Keyboard Movement -------------------- */
|
||||
|
||||
Reference in New Issue
Block a user