Skip to content

Commit dd2f1d7

Browse files
red-001nerzhul
authored andcommittedMar 24, 2017
Add multiline support to colorize. (#5444)
1 parent 072bbba commit dd2f1d7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

Diff for: ‎builtin/common/misc_helpers.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,14 @@ else
667667
end
668668

669669
function core.colorize(color, message)
670-
return core.get_color_escape_sequence(color) .. message .. core.get_color_escape_sequence("#ffffff")
670+
local lines = message:split("\n", true)
671+
local color_code = core.get_color_escape_sequence(color)
672+
673+
for i, line in ipairs(lines) do
674+
lines[i] = colour_code .. line
675+
end
676+
677+
return table.concat(lines, "\n") .. core.get_color_escape_sequence("#ffffff")
671678
end
672679

673680
end

0 commit comments

Comments
 (0)
Please sign in to comment.