1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

log: avoid using string__plus memory leak (#11128)

This commit is contained in:
wilesun
2021-08-11 14:26:02 +08:00
committed by GitHub
parent 70124d2d23
commit 18be9e52be
3 changed files with 24 additions and 5 deletions

View File

@ -4,12 +4,11 @@
module term
pub fn format(msg string, open string, close string) string {
return '\x1b[' + open + 'm' + msg + '\x1b[' + close + 'm'
return '\x1b[${open}m$msg\x1b[${close}m'
}
pub fn format_rgb(r int, g int, b int, msg string, open string, close string) string {
return '\x1b[' + open + ';2;' + r.str() + ';' + g.str() + ';' + b.str() + 'm' + msg + '\x1b[' +
close + 'm'
return '\x1b[$open;2;$r;$g;${b}m$msg\x1b[${close}m'
}
pub fn rgb(r int, g int, b int, msg string) string {