Fix search update bug.

This commit is contained in:
gmp
2026-05-28 20:46:54 -04:00
parent 831f0dac81
commit a1ef84609f
3 changed files with 23 additions and 15 deletions
+3 -4
View File
@@ -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