Ticket #1799: colorize.diff

File colorize.diff, 1.9 KB (added by curium, 2 years ago)

Diff that replaces append with cons, returns reversed result, exports htmlize.

  • colorize/0.4.5/colorize.scm

    diff --git a/colorize/0.4.5/colorize.scm b/colorize/0.4.5/colorize.scm
    index ea4016ff..b9c16747 100644
    a b  
    3434;;    not because the colorizing macro is so elegant ;)
    3535
    3636(module colorize
    37   (html-colorize coloring-type-names coloring-type-exists? scan-string)
     37  (html-colorize htmlize coloring-type-names coloring-type-exists? scan-string)
    3838
    3939(import (chicken base) (chicken syntax)
    4040        (chicken format) (chicken string)
     
    287287                       (let ((to (if extend new-position current-position)))
    288288                         (when (> to low-bound)
    289289                           (set! result
    290                                  (append result
    291                                          (list (cons (cons current-mode
    292                                                            mode-stack)
    293                                                      (substring/shared
    294                                                       str low-bound to))))))
     290                                 (cons (cons (cons current-mode
     291                                                   mode-stack)
     292                                             (substring/shared
     293                                              str low-bound to))
     294                                       result)))
    295295                         (set! low-bound to)
    296296                         (when (eq? action 'pop)
    297297                           (set! mode-stack (cdr mode-stack))
     
    309309                         (*scan-calls*))
    310310                 (finish-current (string-length str) #f
    311311                                 (lambda _ (values #f #f)) 'none)
    312                  (return result))
     312                 (return (reverse result)))
    313313               (or (any (lambda (transition-info)
    314314                          (and-let* ((transition-mode (car transition-info))
    315315                                     ((or (eqv? transition-mode current-mode)