Improve the workaround: avoid window flicker.

This commit is contained in:
Vincent Zhang 2021-10-18 22:43:11 +08:00
parent 084370d7a9
commit aed094c437

View file

@ -803,6 +803,7 @@ etc. (also see the face `doom-modeline-unread-number')."
;; FIXME #183: Force to calculate mode-line height
;; @see https://github.com/seagle0128/doom-modeline/issues/183
;; @see https://github.com/seagle0128/doom-modeline/issues/483
(defvar-local doom-modeline--size-hacked-p nil)
(defun doom-modeline-redisplay (&rest _)
"Call `redisplay' to trigger mode-line height calculations.
@ -823,8 +824,9 @@ from that of the `default' face. This function is intended to be
used as an advice to window creation functions."
(when (and (bound-and-true-p doom-modeline-mode)
mode-line-format
(/= (frame-char-height) (window-mode-line-height)))
(redisplay t)))
(not doom-modeline--size-hacked-p))
(redisplay t)
(setq doom-modeline--size-hacked-p t)))
(advice-add 'split-window :after #'doom-modeline-redisplay)
;; Keep `doom-modeline-current-window' up-to-date