Skip to content

Commit cf031d2

Browse files
committed
fix(sclang): post empty lines
Empty lines on stdout were discarded to avoid duplication of new lines, but they should be visible in the post window.
1 parent 8148e9b commit cf031d2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lua/scnvim/sclang.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ local on_stdout = function()
2727
local str = table.concat(stack, '')
2828
local got_line = vim.endswith(str, '\n')
2929
if got_line then
30-
local lines = vim.gsplit(str, '\n')
31-
for line in lines do
32-
if line ~= '' then
33-
M.on_output(line)
34-
end
30+
local lines = vim.split(str, '\n')
31+
if #lines > 0 and lines[#lines] == "" then
32+
table.remove(lines)
33+
end
34+
for _, line in pairs(lines) do
35+
M.on_output(line)
3536
end
3637
stack = { '' }
3738
end

0 commit comments

Comments
 (0)