emacs: guard against empty string in prot-modeline--string-truncate-p

This commit is contained in:
Protesilaos Stavrou 2024-02-18 17:33:20 +02:00
parent e2908a9452
commit f3a1616a9d
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 10 additions and 6 deletions

View file

@ -12791,9 +12791,11 @@ package).")
(defun prot-modeline--string-truncate-p (str)
"Return non-nil if STR should be truncated."
(and (prot-common-window-narrow-p)
(> (length str) prot-modeline-string-truncate-length)
(not (one-window-p :no-minibuffer))))
(if (string-empty-p str)
str
(and (prot-common-window-narrow-p)
(> (length str) prot-modeline-string-truncate-length)
(not (one-window-p :no-minibuffer)))))
(defun prot-modeline--truncate-p ()
"Return non-nil if truncation should happen.

View file

@ -192,9 +192,11 @@ package).")
(defun prot-modeline--string-truncate-p (str)
"Return non-nil if STR should be truncated."
(and (prot-common-window-narrow-p)
(> (length str) prot-modeline-string-truncate-length)
(not (one-window-p :no-minibuffer))))
(if (string-empty-p str)
str
(and (prot-common-window-narrow-p)
(> (length str) prot-modeline-string-truncate-length)
(not (one-window-p :no-minibuffer)))))
(defun prot-modeline--truncate-p ()
"Return non-nil if truncation should happen.