From 4454fcc3a2c66f29aab8c1073a251243fc3e3d49 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Fri, 4 Aug 2023 15:40:02 +0200 Subject: [PATCH] Use proper timeouts for coroutines that don't need to wait (#1467) --- data/core/doc/highlighter.lua | 2 +- data/plugins/projectsearch.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/core/doc/highlighter.lua b/data/core/doc/highlighter.lua index b1367049..14868674 100644 --- a/data/core/doc/highlighter.lua +++ b/data/core/doc/highlighter.lua @@ -48,7 +48,7 @@ function Highlighter:start() self:update_notify(retokenized_from, max - retokenized_from) end core.redraw = true - coroutine.yield() + coroutine.yield(0) end self.max_wanted_line = 0 self.running = false diff --git a/data/plugins/projectsearch.lua b/data/plugins/projectsearch.lua index cc5e1324..8c8dfd95 100644 --- a/data/plugins/projectsearch.lua +++ b/data/plugins/projectsearch.lua @@ -37,7 +37,7 @@ local function find_all_matches_in_file(t, filename, fn) table.insert(t, { file = filename, text = (start_index > 1 and "..." or "") .. line:sub(start_index, 256 + start_index), line = n, col = s }) core.redraw = true end - if n % 100 == 0 then coroutine.yield() end + if n % 100 == 0 then coroutine.yield(0) end n = n + 1 core.redraw = true end