Skip to content

Commit

Permalink
Add multiline support to colorize. (#5444)
Browse files Browse the repository at this point in the history
  • Loading branch information
red-001 authored and nerzhul committed Mar 24, 2017
1 parent 072bbba commit dd2f1d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion builtin/common/misc_helpers.lua
Expand Up @@ -667,7 +667,14 @@ else
end

function core.colorize(color, message)
return core.get_color_escape_sequence(color) .. message .. core.get_color_escape_sequence("#ffffff")
local lines = message:split("\n", true)
local color_code = core.get_color_escape_sequence(color)

for i, line in ipairs(lines) do
lines[i] = colour_code .. line
end

return table.concat(lines, "\n") .. core.get_color_escape_sequence("#ffffff")
end

end

0 comments on commit dd2f1d7

Please sign in to comment.