From 81deebe4cc3621e021f28a9186c74cc77382b80c Mon Sep 17 00:00:00 2001 From: Peter Kosyh Date: Wed, 13 Sep 2023 16:10:47 +0300 Subject: [PATCH] red: | fix --- data/lib/red/proc.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/data/lib/red/proc.lua b/data/lib/red/proc.lua index 112f0c6..c6a8b83 100644 --- a/data/lib/red/proc.lua +++ b/data/lib/red/proc.lua @@ -182,16 +182,20 @@ local function pipe(w, prog, tmp) local f = io.popen(prog, "r") if not f then return end local p = w:run(function() - w:tail() +-- w:tail() local num = 1 + local cur = w:cur() + w:history 'start' for l in f:lines() do - w:append(l ..'\n') + w.buf:input(l ..'\n') num = num + 1 - if num % 10 == 0 then + if num % 100 == 0 then coroutine.yield() end end f:close() + w:history 'end' + w:cur(cur) if tmp then os.remove(tmp) end @@ -250,7 +254,7 @@ proc['|'] = function(w, prog) f:write(data.buf:gettext(data.buf:range())) f:close() - pipe(w:output(), 'cat '..tmp..'|'..prog..' 2>&1', tmp) + pipe(w:data(), 'cat '..tmp..'|'..prog..' 2>&1', tmp) end end