diff options
| author | cashmere <cashmere@autistici.org> | 2026-08-23 14:18:25 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-08-23 14:18:25 +0200 |
| commit | e8b0abed0711cefcd0c06b8e12e3a7a9224fb329 (patch) | |
| tree | ad99f2f528d6ba464ad9237e7a97f3b79d9805b9 /lisp/fossil-ui.el | |
| parent | 32bccd667ae70130cf58929dfa07a255f38e03cf (diff) | |
| download | emacs-e8b0abed0711cefcd0c06b8e12e3a7a9224fb329.tar.gz | |
md: 2026-08-23T14:18:31+02:00
Diffstat (limited to 'lisp/fossil-ui.el')
| -rw-r--r-- | lisp/fossil-ui.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/fossil-ui.el b/lisp/fossil-ui.el index 0982e4b..0305d3a 100644 --- a/lisp/fossil-ui.el +++ b/lisp/fossil-ui.el @@ -339,10 +339,14 @@ Paths may contain spaces. A dash in either count denotes binary data." :busy nil :error nil))) +(defun fossil-ui--single-line (value) + "Return VALUE as a string without native-widget line breaks." + (replace-regexp-in-string "[\r\n]+" " " (format "%s" (or value "")))) + (defun fossil-ui--fit (value width &optional face) "Return VALUE truncated or padded to WIDTH, optionally using FACE." (let* ((width (max 0 width)) - (value (truncate-string-to-width (format "%s" (or value "")) + (value (truncate-string-to-width (fossil-ui--single-line value) width nil nil "...")) (result (concat value (make-string (max 0 (- width (string-width value))) ?\s)))) @@ -350,8 +354,9 @@ Paths may contain spaces. A dash in either count denotes binary data." (defun fossil-ui--item (value &optional face) "Return a TextUI item for VALUE with optional FACE." - `(:type item :format "%v" - :value ,(if face (propertize value 'face face) value))) + (let ((value (fossil-ui--single-line value))) + `(:type item :format "%v" + :value ,(if face (propertize value 'face face) value)))) (defun fossil-ui--icons-p () "Return non-nil when dashboard Nerd Font icons should be used." |
