Allow stripping SGR from sgr-list.
This commit is contained in:
parent
870335c637
commit
2041fef742
1 changed files with 5 additions and 2 deletions
|
@ -208,7 +208,8 @@
|
||||||
;; Converts a SGR list into a single string
|
;; Converts a SGR list into a single string
|
||||||
(define* (sgr-list->string lst
|
(define* (sgr-list->string lst
|
||||||
(initial-state empty-sgr-state)
|
(initial-state empty-sgr-state)
|
||||||
#:reset-state (reset-state #f))
|
#:reset-state (reset-state #f)
|
||||||
|
#:strip-ansi? (strip-ansi? #f))
|
||||||
(let loop ((lst lst)
|
(let loop ((lst lst)
|
||||||
(res '())
|
(res '())
|
||||||
(state initial-state))
|
(state initial-state))
|
||||||
|
@ -221,7 +222,9 @@
|
||||||
(let ((token (car lst)))
|
(let ((token (car lst)))
|
||||||
(if (sgr-state? token)
|
(if (sgr-state? token)
|
||||||
(loop (cdr lst)
|
(loop (cdr lst)
|
||||||
(cons (sgr-state-change->string state token) res)
|
(if strip-ansi?
|
||||||
|
res
|
||||||
|
(cons (sgr-state-change->string state token) res))
|
||||||
token)
|
token)
|
||||||
(loop (cdr lst)
|
(loop (cdr lst)
|
||||||
(cons (car token) res)
|
(cons (car token) res)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue