mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
Merge pull request #591 from krzygorz/ansi-fix
(chibi show): Make ANSI escape codes work with col state variable
This commit is contained in:
commit
33d6cfd0ac
2 changed files with 5 additions and 1 deletions
|
@ -733,12 +733,16 @@ def | 6
|
||||||
(test "\x1B;[31mred\x1B;[0m" (show #f (as-red "red")))
|
(test "\x1B;[31mred\x1B;[0m" (show #f (as-red "red")))
|
||||||
(test "\x1B;[31mred\x1B;[34mblue\x1B;[31mred\x1B;[0m"
|
(test "\x1B;[31mred\x1B;[34mblue\x1B;[31mred\x1B;[0m"
|
||||||
(show #f (as-red "red" (as-blue "blue") "red")))
|
(show #f (as-red "red" (as-blue "blue") "red")))
|
||||||
|
(test "\x1b;[31m1234567\x1b;[0m col: 7"
|
||||||
|
(show #f (as-unicode (as-red "1234567") (fn ((col)) (each " col: " col)))))
|
||||||
|
|
||||||
;; unicode
|
;; unicode
|
||||||
(test "〜日本語〜"
|
(test "〜日本語〜"
|
||||||
(show #f (with ((pad-char #\〜)) (padded/both 5 "日本語"))))
|
(show #f (with ((pad-char #\〜)) (padded/both 5 "日本語"))))
|
||||||
(test "日本語"
|
(test "日本語"
|
||||||
(show #f (as-unicode (with ((pad-char #\〜)) (padded/both 5 "日本語")))))
|
(show #f (as-unicode (with ((pad-char #\〜)) (padded/both 5 "日本語")))))
|
||||||
|
(test "日本語 col: 6"
|
||||||
|
(show #f (as-unicode "日本語" (fn ((col)) (each " col: " col)))))
|
||||||
|
|
||||||
;; from-file
|
;; from-file
|
||||||
;; for reference, filesystem-test relies on creating files under /tmp
|
;; for reference, filesystem-test relies on creating files under /tmp
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
(else "0")))
|
(else "0")))
|
||||||
|
|
||||||
(define (ansi-escape color)
|
(define (ansi-escape color)
|
||||||
(each (integer->char 27) "[" (color->ansi color) "m"))
|
(string-append (string (integer->char 27)) "[" (color->ansi color) "m"))
|
||||||
|
|
||||||
(define (colored new-color . args)
|
(define (colored new-color . args)
|
||||||
(fn (color)
|
(fn (color)
|
||||||
|
|
Loading…
Add table
Reference in a new issue