diff --git a/src/misc-utils.lisp b/src/misc-utils.lisp index fc86afe..2599395 100644 --- a/src/misc-utils.lisp +++ b/src/misc-utils.lisp @@ -949,4 +949,7 @@ to the array" (defmacro with-profile-time (&body body) `(with-output-to-string (stream) (let ((*trace-output* stream)) - (time ,@body)))) + (time (progn ,@body))))) + +(defmacro with-debug-print-profile-time ((&optional prefix) &body body) + `(misc:dbg "~a ~a" ,prefix (with-profile-time ,@body))) diff --git a/src/package.lisp b/src/package.lisp index f94f647..b211b61 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -230,7 +230,8 @@ :defun-w-lock :with-lock :get-url-content - :with-profile-time)) + :with-profile-time + :with-debug-print-profile-time)) (defpackage :box (:use diff --git a/src/software-configuration.lisp b/src/software-configuration.lisp index 1fd3660..f724807 100644 --- a/src/software-configuration.lisp +++ b/src/software-configuration.lisp @@ -231,7 +231,7 @@ (color-name-p (keywordp color)) (attributes (first (fourth parsed)))) (list (first clean) - (make-color-re-assign re + (make-color-re-assign (cl-ppcre:create-scanner re) (and color-name-p color) (and (not color-name-p) color) attributes)))) diff --git a/src/tui-utils.lisp b/src/tui-utils.lisp index e8bd228..6392381 100644 --- a/src/tui-utils.lisp +++ b/src/tui-utils.lisp @@ -295,10 +295,23 @@ latter has a length equals to `total-size'")) (bgcolor nil) (attributes nil) (return-as-list-p t)) + (colorize-line line + (create-scanner regexp) + :fgcolor fgcolor + :bgcolor bgcolor + :attributes attributes + :return-as-list-p return-as-list-p)) + +(defmethod colorize-line ((line string) (regexp function) + &key + (fgcolor nil) + (bgcolor nil) + (attributes nil) + (return-as-list-p t)) (let ((res ()) - (scanner (create-scanner regexp))) + (scanner regexp)) (labels ((append-to-res (data) - (setf res (append res (list data)))) + (setf res (reverse (push data res)))) (re-split (data) (when (string-not-empty-p data) (multiple-value-bind (start-re end-re)