Display multi-line messages in the console properly.
This commit is contained in:
parent
de98dea8fb
commit
fd545af9f2
13
console.lua
13
console.lua
@ -112,11 +112,18 @@ function snippets.push_console_msg(name, msg, col)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local text = forms[name] and forms[name].context.text
|
local text = forms[name] and forms[name].context.text
|
||||||
if text then
|
if not text then return end
|
||||||
table.insert(text, col .. tostring(msg))
|
|
||||||
snippets.update_console(name)
|
msg = tostring(msg)
|
||||||
|
for _, line in ipairs(msg:split('\n', true)) do
|
||||||
|
text[#text + 1] = col .. line
|
||||||
|
if #text > 501 then
|
||||||
|
text[1] = '#aaaaaaSnippets only stores 500 lines of scrollback.'
|
||||||
|
table.remove(text, 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
snippets.update_console(name)
|
||||||
|
end
|
||||||
|
|
||||||
snippets.register_on_log(function(snippet, level, msg)
|
snippets.register_on_log(function(snippet, level, msg)
|
||||||
local owner = snippets.registered_snippets[snippet].owner
|
local owner = snippets.registered_snippets[snippet].owner
|
||||||
|
Loading…
x
Reference in New Issue
Block a user