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:
@@ -7,14 +7,15 @@ import (
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
proj := widget.CurrentProject()
|
||||
|
||||
if proj == nil {
|
||||
return
|
||||
return widget.CommonSettings().Title, "", false
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("[green]%s[white]", proj.Project.Name)
|
||||
|
||||
str := ""
|
||||
|
||||
for idx, item := range proj.tasks {
|
||||
@@ -27,6 +28,9 @@ func (widget *Widget) display() {
|
||||
|
||||
str += utils.HighlightableHelper(widget.View, row, idx, len(item.Content))
|
||||
}
|
||||
|
||||
widget.ScrollableWidget.Redraw(title, str, false)
|
||||
return title, str, false
|
||||
}
|
||||
|
||||
func (widget *Widget) display() {
|
||||
widget.ScrollableWidget.RedrawFunc(widget.content)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user