summaryrefslogtreecommitdiffhomepage
path: root/lib/eos
diff options
context:
space:
mode:
Diffstat (limited to 'lib/eos')
-rw-r--r--lib/eos/jao-minibuffer.el33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index 09497e8..515f31b 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -48,7 +48,8 @@
(setq jao-minibuffer--overlays nil))
(defun jao-minibuffer--set-overlays (txt)
- (let* ((wid (+ (string-width txt)))
+ (let* ((txt (concat txt jao-minibuffer-right-margin))
+ (wid (string-width txt))
(align `(space :align-to (- right-fringe ,wid)))
(spc (propertize " " 'cursor 1 'display align))
(txt (concat spc txt)))
@@ -84,21 +85,22 @@
(reverse (or info jao-minibuffer-info)))))
" "))
-(defun jao-minibuffer--aligned (&optional w msg)
+(defun jao-minibuffer--aligned (left msg)
(let* ((msg (or msg (jao-minibuffer--format-info)))
(msg (cond (jao-minibuffer-align-right-p (string-trim msg))
(t (string-trim-left msg))))
- (msg (propertize msg :minibuffer-message t)))
- (unless (string-empty-p msg)
+ (w (string-width left)))
+ (unless (and (string-empty-p left) (string-empty-p msg))
(let* ((mw (jao-minibuffer--width))
- (w (- mw (mod w mw) (string-width jao-minibuffer-right-margin) -1)))
- (if (> w 0) (jao-minibuffer--trim msg w) "")))))
+ (w (- mw (mod w mw) (string-width jao-minibuffer-right-margin) -1))
+ (right (if (> w 0) (jao-minibuffer--trim msg w) "")))
+ (concat left right jao-minibuffer-right-margin)))))
(defun jao-minibuffer--insert (msg)
- (let ((hack (derived-mode-p 'pdf-view-mode 'doc-view-mode)))
+ (let ((hack (and nil (derived-mode-p 'pdf-view-mode 'doc-view-mode))))
(with-current-buffer jao-minibuffer--name
(delete-region (point-min) (point-max))
- (insert msg)
+ (insert (or msg ""))
(when hack (other-window 1) (other-window -1)))))
(defun jao-minibuffer--strip-prev (msg)
@@ -183,7 +185,7 @@
(progn (advice-add 'select-window :after #'jao-minibuffer-refresh)
(advice-add 'force-mode-line-update :after #'jao-minibuffer-refresh)
(jao-minibuffer--create-overlays)
- (add-hook 'minibuffer-setup-hook #'jao-minibuffer--minibuffer-setup)
+ ;; (add-hook 'minibuffer-setup-hook #'jao-minibuffer--minibuffer-setup)
(jao-minibuffer-refresh))
(advice-remove 'select-window #'jao-minibuffer-refresh)
(advice-remove 'force-mode-line-update #'jao-minibuffer-refresh)
@@ -195,13 +197,12 @@
(defun jao-minibuffer-refresh (&rest _ignore)
(interactive)
(when jao-minibuffer-mode
- (let* ((jao-minibuffer-mode nil)
- (window-selection-change-functions nil)
- (msg (jao-minibuffer--format-info))
- (msg-left (jao-minibuffer--format-info jao-minibuffer-msg-info))
- (msg-right (jao-minibuffer--aligned (string-width msg-left) msg)))
- (jao-minibuffer--set-overlays msg)
- (jao-minibuffer--insert (concat msg-left msg-right)))))
+ (let ((jao-minibuffer-mode nil)
+ (window-selection-change-functions nil)
+ (right (jao-minibuffer--format-info))
+ (left (jao-minibuffer--format-info jao-minibuffer-msg-info)))
+ (jao-minibuffer--set-overlays right)
+ (jao-minibuffer--insert (jao-minibuffer--aligned left right)))))
;; (add-hook 'window-selection-change-functions #'jao-minibuffer-refresh)