Fix search update bug.
This commit is contained in:
+3
-4
@@ -59,12 +59,11 @@ func run(w *app.Window) error {
|
||||
currentElems := elems
|
||||
renderer.Draw(gtx, currentElems)
|
||||
logic.DisplayLineChan() <- int(renderer.LastLineY())
|
||||
// Check for search query change — trigger a new frame if the
|
||||
// widget.Editor text differs from the logic's stored query.
|
||||
// This ensures the filtered list updates as the user types.
|
||||
// Send search query update to the logic goroutine when it changes.
|
||||
// The logic goroutine handles filtering and triggers a new frame.
|
||||
newQuery := logic.State().SearchEditor.Text()
|
||||
if newQuery != logic.State().SearchQuery {
|
||||
logic.InputChan() <- []ui.InputEvent{}
|
||||
logic.SearchQueryChan() <- newQuery
|
||||
}
|
||||
if events := renderer.CheckGestures(e.Source, gtx.Metric); len(events) > 0 {
|
||||
logic.InputChan() <- events
|
||||
|
||||
Reference in New Issue
Block a user