Skip to content

Commit

Permalink
fix wrong minibuffer size on prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
QiangF committed Jan 18, 2024
1 parent 86e753b commit c51956d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions mini-modeline.el
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,13 @@ When ARG is:
(let ((height-delta (- (cdr mini-modeline--cache)
(window-height (minibuffer-window mini-modeline-frame))))
;; ; let mini-modeline take control of mini-buffer size
(resize-mini-windows t))
(resize-mini-windows 'grow-only))
(when (or (> height-delta 0)
;; this is to prevent window flashing for consecutive multi-line message
(mini-modeline--overduep mini-modeline--last-change-size
mini-modeline-echo-duration))
(window-resize (minibuffer-window mini-modeline-frame) height-delta)
(run-at-time 0.01 nil (lambda ()
(window-resize (minibuffer-window mini-modeline-frame) height-delta)))
(setq mini-modeline--last-change-size (current-time)))
(insert (car mini-modeline--cache))))))))))
((error debug)
Expand All @@ -273,7 +274,8 @@ When ARG is:
"Render the LEFT and RIGHT part of mini-modeline."
(let* ((left (or left ""))
(right (or right ""))
(available-width (max (- (frame-width mini-modeline-frame)
(frame-width (frame-width mini-modeline-frame))
(available-width (max (- frame-width
(string-width left)
mini-modeline-right-padding)
0))
Expand All @@ -286,9 +288,8 @@ When ARG is:
(format (format "%%s %%%d.%ds" available-width available-width) left right)
0)
(cons
(let ((available-width (+ available-width (string-width left))))
(format (format "%%0.%ds\n%%s" available-width) right left))
(ceiling (string-width left) (frame-width mini-modeline-frame))))
(format (format "%%%d.%ds\n%%s" (- frame-width 1) (- frame-width 1)) right left)
(ceiling (string-width left) frame-width)))
(cons (format (format "%%s %%%ds" available-width) left right) 0))))

(defun mini-modeline--multi-lr-render (left right)
Expand Down Expand Up @@ -344,7 +345,7 @@ BODY will be supplied with orig-func and args."
(when mini-modeline-enhance-visual
(with-current-buffer mini-modeline--minibuffer
(mini-modeline--set-buffer-face)))
(setq resize-mini-windows nil))
(setq resize-mini-windows mini-modeline--orig-resize-mini-windows))

(declare-function anzu--cons-mode-line "ext:anzu")
(declare-function anzu--reset-mode-line "ext:anzu")
Expand Down Expand Up @@ -392,11 +393,10 @@ BODY will be supplied with orig-func and args."
'mini-modeline-mode-line-inactive
(default-value 'face-remapping-alist) face-remaps))))

(setq mini-modeline--orig-resize-mini-windows resize-mini-windows)
(setq resize-mini-windows nil)
(setq resize-mini-windows mini-modeline--orig-resize-mini-windows)
(redisplay)
;; (add-hook 'pre-redisplay-functions #'mini-modeline-display)
(setq mini-modeline--timer (run-with-timer 0 0.1 #'mini-modeline-display))
(setq mini-modeline--timer (run-with-idle-timer 0.1 t #'mini-modeline-display))
(advice-add #'message :around #'mini-modeline--reroute-msg)

(add-hook 'minibuffer-setup-hook #'mini-modeline--enter-minibuffer)
Expand Down

0 comments on commit c51956d

Please sign in to comment.