mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-12-22 03:00:43 -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
|
var i: int
|
||||||
while i < s.len:
|
while i < s.len:
|
||||||
if s[i] == '\e':
|
if s[i] == '\e':
|
||||||
while s[i] != 'm':
|
|
||||||
inc i
|
inc i
|
||||||
|
if i < s.len and s[i] == '[':
|
||||||
inc i
|
inc i
|
||||||
if i < s.len:
|
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]
|
result.add s[i]
|
||||||
inc i
|
inc i
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue