From 317f90a036c996bce5bed5cb15f606e8fd8f8a09 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 27 Jan 2022 19:02:03 +0000 Subject: jao-minibuffer: prefer string-width to length --- lib/eos/jao-minibuffer.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/eos') 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 "")))) -- cgit v1.2.3