diff --git a/modules/ui/nav-flash/autoload.el b/modules/ui/nav-flash/autoload.el index 53d7bfb60..980e129c7 100644 --- a/modules/ui/nav-flash/autoload.el +++ b/modules/ui/nav-flash/autoload.el @@ -1,19 +1,19 @@ ;;; ui/nav-flash/autoload.el -*- lexical-binding: t; -*- ;;;###autoload -(defun +doom*blink-cursor-maybe (orig-fn &rest args) +(defun +nav-flash*blink-cursor-maybe (orig-fn &rest args) "Blink current line if the window has moved." - (let ((point (save-excursion (goto-char (window-start)) - (point-marker)))) - (apply orig-fn args) - (unless (or (derived-mode-p 'term-mode) - (equal point - (save-excursion (goto-char (window-start)) - (point-marker)))) - (+doom/blink-cursor)))) + (if (or (not (window-start)) + (derived-mode-p 'term-mode)) + (apply orig-fn args) + (let* ((win-beg (window-start)) + (point (save-excursion (goto-char win-beg) (point-marker)))) + (apply orig-fn args) + (unless (equal point (save-excursion (goto-char win-beg) (point-marker))) + (+nav-flash/blink-cursor))))) ;;;###autoload -(defun +doom/blink-cursor (&rest _) +(defun +nav-flash/blink-cursor (&rest _) "Blink current line using `nav-flash'." (interactive) (unless (minibufferp) diff --git a/modules/ui/nav-flash/config.el b/modules/ui/nav-flash/config.el index 16617b423..bfc7743d9 100644 --- a/modules/ui/nav-flash/config.el +++ b/modules/ui/nav-flash/config.el @@ -5,16 +5,16 @@ :init ;; NOTE In :feature jump `recenter' is hooked to a bunch of jumping commands, ;; which will trigger nav-flash. - (advice-add #'windmove-do-window-select :around #'+doom*blink-cursor-maybe) - (advice-add #'recenter :around #'+doom*blink-cursor-maybe) + (add-hook 'doom-after-switch-window-hook #'+nav-flash/blink-cursor) + (advice-add #'recenter :around #'+nav-flash*blink-cursor-maybe) - (advice-add #'save-place-find-file-hook :after #'+doom/blink-cursor) + (advice-add #'save-place-find-file-hook :after #'+nav-flash/blink-cursor) (after! evil - (advice-add #'evil--jumps-jump :after #'+doom/blink-cursor) + (advice-add #'evil--jumps-jump :after #'+nav-flash/blink-cursor) - (advice-add #'evil-window-top :after #'+doom/blink-cursor) - (advice-add #'evil-window-middle :after #'+doom/blink-cursor) - (advice-add #'evil-window-bottom :after #'+doom/blink-cursor))) + (advice-add #'evil-window-top :after #'+nav-flash/blink-cursor) + (advice-add #'evil-window-middle :after #'+nav-flash/blink-cursor) + (advice-add #'evil-window-bottom :after #'+nav-flash/blink-cursor)))