about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-11-13 11:17:40 +0100
committerbptato <nincsnevem662@gmail.com>2021-11-13 11:17:40 +0100
commita6099512e42cc95cf6276ab784afd70febdd43b7 (patch)
treedef2061199d9f119a3176858e331ba376c89e2c5 /src/utils/twtstr.nim
parentc141a3cea17f32f526853cd4085ae4cc80c4fed6 (diff)
downloadchawan-a6099512e42cc95cf6276ab784afd70febdd43b7.tar.gz
Parse ansi escape codes when displaying plain text
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index db5a1293..27269169 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -190,7 +190,7 @@ func skipBlanks*(buf: string, at: int): int =
   while result < buf.len and buf[result].isWhitespace():
     inc result
 
-template ESC*(s: varargs[string, `$`]): string =
+template CSI*(s: varargs[string, `$`]): string =
   var r = "\e["
   var first = true
   for x in s:
@@ -201,13 +201,13 @@ template ESC*(s: varargs[string, `$`]): string =
   r
 
 template SGR*(s: varargs[string, `$`]): string =
-  ESC(s) & "m"
+  CSI(s) & "m"
 
 template HVP*(s: varargs[string, `$`]): string =
-  ESC(s) & "f"
+  CSI(s) & "f"
 
 template EL*(s: varargs[string, `$`]): string =
-  ESC(s) & "K"
+  CSI(s) & "K"
 
 iterator split*(s: seq[Rune], sep: Rune): seq[Rune] =
   var i = 0