summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-01-27 19:02:03 +0000
committerjao <jao@gnu.org>2022-01-27 19:02:03 +0000
commit317f90a036c996bce5bed5cb15f606e8fd8f8a09 (patch)
tree8b2aaf63967c124326b0265a72fdcc7140e8471d
parentaa535ab7614d48b895f3bf8183b367c0ea51370f (diff)
downloadelibs-317f90a036c996bce5bed5cb15f606e8fd8f8a09.tar.gz
elibs-317f90a036c996bce5bed5cb15f606e8fd8f8a09.tar.bz2
jao-minibuffer: prefer string-width to length
-rw-r--r--lib/eos/jao-minibuffer.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index 5fdb18b..1777465 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -61,7 +61,7 @@
(msg (propertize msg :minibuffer-message t)))
(unless (string-empty-p msg)
(let* ((mw (jao-minibuffer--width))
- (w (- mw (mod w mw) (length jao-minibuffer-right-margin) -1)))
+ (w (- mw (mod w mw) (string-width jao-minibuffer-right-margin) -1)))
(if (> w 0) (jao-minibuffer--trim msg w) "")))))
(defun jao-minibuffer--insert (msg)
@@ -82,10 +82,11 @@
(prefix (when-let (p (string-join (butlast msgs) "\n"))
(unless (string-blank-p p) (concat p "\n"))))
(msg (car (last msgs)))
- (msg (if (string-blank-p msg) msg (concat msg " "))))
+ (msg (if (string-blank-p msg) msg (concat msg " ")))
+ (w (string-width msg)))
(if jao-minibuffer-align-right-p
- (concat prefix msg (jao-minibuffer--aligned (length msg)))
- (concat prefix (jao-minibuffer--aligned (+ 3 (length msg))) " " msg))))
+ (concat prefix msg (jao-minibuffer--aligned w))
+ (concat prefix (jao-minibuffer--aligned (+ 3 w)) " " msg))))
(defun jao-minibuffer--set-message (msg)
(when jao-minibuffer-mode (jao-minibuffer--format-msg (or msg ""))))