diff options
author | takase1121 <20792268+takase1121@users.noreply.github.com> | 2021-10-21 13:29:38 +0800 |
---|---|---|
committer | takase1121 <20792268+takase1121@users.noreply.github.com> | 2021-10-21 13:29:38 +0800 |
commit | 1ba61c4ba5ee28bb84f04c6fbbbf57f91766b5c6 (patch) | |
tree | 7f06bc36e07fa1a1e11dec9c7b36de5765d66dd3 | |
parent | 21912c536374240bd37b5d6dd34e97caaf2ed4a7 (diff) | |
download | lite-xl-plugins-1ba61c4ba5ee28bb84f04c6fbbbf57f91766b5c6.tar.gz lite-xl-plugins-1ba61c4ba5ee28bb84f04c6fbbbf57f91766b5c6.zip |
fix skipping output if fc-match exits early
-rw-r--r-- | plugins/fontconfig.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/fontconfig.lua b/plugins/fontconfig.lua index 9702422..657e364 100644 --- a/plugins/fontconfig.lua +++ b/plugins/fontconfig.lua @@ -32,18 +32,18 @@ local function resolve_font(spec) }) local prev local lines = {} - while proc:running() do + while true do coroutine.yield(scan_rate) local buf = proc:read_stdout() - if type(buf) == "string" then - local last_line_start = 1 - for line, ln in string.gmatch(buf, "([^\n]-)\n()") do - last_line_start = ln - if prev then line = prev .. line end - table.insert(lines, line) - end - prev = last_line_start < #buf and string.sub(buf, last_line_start) + if not buf then break end + + local last_line_start = 1 + for line, ln in string.gmatch(buf, "([^\n]-)\n()") do + last_line_start = ln + if prev then line = prev .. line end + table.insert(lines, line) end + prev = last_line_start < #buf and string.sub(buf, last_line_start) end if prev then table.insert(lines, prev) end |