Don't recalculate while typing

This commit is contained in:
Lars Tveito 2020-03-08 20:48:58 +01:00
parent 872f24cb26
commit 9af4fbe635

View File

@ -183,24 +183,25 @@ If `focus-mode' is enabled, this function is added to
`post-command-hook' and `window-scroll-functions'. The function `post-command-hook' and `window-scroll-functions'. The function
can be called with an arbitrary number of ARGS to support being can be called with an arbitrary number of ARGS to support being
called from `window-scroll-functions'." called from `window-scroll-functions'."
(with-current-buffer focus-buffer (while-no-input
(let* ((bg (face-background 'default)) (with-current-buffer focus-buffer
(window-bounds (focus-window-bounds)) (let* ((bg (face-background 'default))
(bounds (focus-bounds))) (window-bounds (focus-window-bounds))
(when (and bounds (or (not (equal bg focus-last-background)) (bounds (focus-bounds)))
(not (equal window-bounds focus-last-window-bounds)) (when (and bounds (or (not (equal bg focus-last-background))
(not (equal bounds focus-last-bounds)))) (not (equal window-bounds focus-last-window-bounds))
(let ((start (car window-bounds)) (not (equal bounds focus-last-bounds))))
(end (cdr window-bounds)) (let ((start (car window-bounds))
(low (car bounds)) (end (cdr window-bounds))
(high (cdr bounds))) (low (car bounds))
(focus-remove-unfocused-overlays) (high (cdr bounds)))
(focus-dim-area start low) (focus-remove-unfocused-overlays)
(focus-dim-area high end) (focus-dim-area start low)
(move-overlay focus-focused-overlay low high))) (focus-dim-area high end)
(setq focus-last-background bg) (move-overlay focus-focused-overlay low high)))
(setq focus-last-window-bounds window-bounds) (setq focus-last-background bg)
(setq focus-last-bounds bounds)))) (setq focus-last-window-bounds window-bounds)
(setq focus-last-bounds bounds)))))
(defun focus-make-focused-overlay () (defun focus-make-focused-overlay ()
(let ((o (make-overlay (point-min) (point-max)))) (let ((o (make-overlay (point-min) (point-max))))