mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-12-21 18:50:44 -06:00
reimplement stripAnsi
This commit is contained in:
parent
efaf252305
commit
f8f62e263d
1 changed files with 7 additions and 3 deletions
|
@ -16,10 +16,14 @@ func stripAnsi*(s: string): string =
|
|||
var i: int
|
||||
while i < s.len:
|
||||
if s[i] == '\e':
|
||||
while s[i] != 'm':
|
||||
inc i
|
||||
inc i
|
||||
if i < s.len:
|
||||
if i < s.len and s[i] == '[':
|
||||
inc i
|
||||
while i < s.len and not (s[i] in {'A'..'Z','a'..'z'}):
|
||||
inc i
|
||||
else:
|
||||
result.add s[i-1]
|
||||
else:
|
||||
result.add s[i]
|
||||
inc i
|
||||
|
||||
|
|
Loading…
Reference in a new issue