diff options
| author | jao <jao@gnu.org> | 2021-06-22 00:40:01 +0100 | 
|---|---|---|
| committer | jao <jao@gnu.org> | 2021-06-22 00:40:01 +0100 | 
| commit | e9ab9070d3171ae3dcc43b3a25da0c01ee6393c8 (patch) | |
| tree | 794f73153216bf9149fb1676dc89d45f8fa486c2 /lib/eos | |
| parent | 109a170ecd32535640b073e6a2e36a974eddba0e (diff) | |
| download | elibs-e9ab9070d3171ae3dcc43b3a25da0c01ee6393c8.tar.gz elibs-e9ab9070d3171ae3dcc43b3a25da0c01ee6393c8.tar.bz2  | |
jao-minibuffer: better multiline messages
Diffstat (limited to 'lib/eos')
| -rw-r--r-- | lib/eos/jao-minibuffer.el | 11 | 
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index 212d738..4528aa7 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -82,11 +82,16 @@      (insert msg)))  (defun jao-minibuffer--format-msg (msg) -  (let* ((msg (string-trim (replace-regexp-in-string "\n" " " msg))) +  (let* ((msgs (split-string msg "\n")) +         (prefix (when-let (p (string-join (butlast msgs) "\n")) +                   (unless (string-blank-p p) (concat p "\n")))) +         (msg (car (last msgs))) +         (msg (string-trim (replace-regexp-in-string "\n" " " msg)))           (msg (if (string-blank-p msg) msg (concat msg "  "))))      (if jao-minibuffer-align-right-p -        (concat msg (jao-minibuffer--aligned (string-width (or msg "")))) -      (concat (jao-minibuffer--aligned (+ 3 (string-width (or msg "")))) +        (concat prefix msg (jao-minibuffer--aligned (string-width (or msg "")))) +      (concat prefix +              (jao-minibuffer--aligned (+ 3 (string-width (or msg ""))))                "   " msg))))  (defun jao-minibuffer--set-message (msg)  | 
