mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Fix race with HighlightableHelper
GetRect can lead to a race condition Add a RenderFunc method so that we can call try to wrap even more of our rendering in the thread safe `QueueUpdateDraw` method
This commit is contained in:
@@ -38,6 +38,16 @@ func (widget *TextWidget) Redraw(title, text string, wrap bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func (widget *TextWidget) RedrawFunc(data func() (string, string, bool)) {
|
||||
widget.app.QueueUpdateDraw(func() {
|
||||
title, content, wrap := data()
|
||||
widget.View.Clear()
|
||||
widget.View.SetWrap(wrap)
|
||||
widget.View.SetTitle(widget.ContextualTitle(title))
|
||||
widget.View.SetText(content)
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *TextWidget) createView(bordered bool) *tview.TextView {
|
||||
|
||||
Reference in New Issue
Block a user