From 695a59158538fde12e0fe156d8c29db7361572db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Wed, 5 Feb 2020 15:46:27 +0700 Subject: [PATCH] srfi-159: fix incorrect "col" calculation with ANSI escape codes `ansi-escape` function outputs the escape code in smaller pieces, however `as-unicode` can only recognize ANSI escape code in one piece. Because of this when you get `col` property from a string with ANSI escape code it gives incorrect column number. For reference, see ashinn/chibi-scheme#591. This should fix #429. --- src/std/srfi/159/color.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/std/srfi/159/color.scm b/src/std/srfi/159/color.scm index b21222d0b..7a324e120 100644 --- a/src/std/srfi/159/color.scm +++ b/src/std/srfi/159/color.scm @@ -18,7 +18,7 @@ (else "0"))) (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) (fn (color)