From c18669e7b5906e4c020abae22aa82630607eea69 Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Thu, 29 Feb 2024 09:36:36 -0500 Subject: [PATCH] Tidying up style, and switch to display in one spot --- termenv/style.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/termenv/style.scm b/termenv/style.scm index 91c8851..fae34c8 100644 --- a/termenv/style.scm +++ b/termenv/style.scm @@ -51,7 +51,7 @@ (define (style->sequence style port) (define str (style-string style)) - (define (just-str) (format port "~a" str)) + (define (just-str) (display str port)) ;; Color sequences aren't strings, so handle them specially ;; Colors don't get resolved until we have the port because we don't know the color profile until then. @@ -72,12 +72,18 @@ (define (cons-seq stylish sequence) (match stylish - ((? string? str) (make-style str (list sequence))) - ((style) (cons-seq style sequence)) - ((? list? l) (make-style-node (map (cut cons-seq <> sequence) l))) - ((? style? style) (set-style-sequences style (cons* sequence (style-sequences style)))) + ((? string? str) + (make-style str (list sequence))) + ((style) + (cons-seq style sequence)) + ((? list? l) + (make-style-node (map (cut cons-seq <> sequence) l))) + ((? style? style) + (set-style-sequences style + (cons* sequence (style-sequences style)))) ((? style-node? node) - (set-style-node-children node (map (cut cons-seq <> sequence) (style-node-children node)))))) + (set-style-node-children node + (map (cut cons-seq <> sequence) (style-node-children node)))))) (define (bold . s) (cons-seq s %BOLD)) (define (faint . s) (cons-seq s %FAINT))