fix: over-aggressive deactivation of hl-line-mode

`(de?)activate-mark-hook` is triggered a little too often in too many
edge cases where the user isn't interactively selecting a region. One
annoying edge case has non-evil motions used on evil operators
activating but not deactivating the mark (e.g. #8047).

This leaves non-evil users without the nicety of hl-line auto-disabling
itself when the region is active, but I'll revisit that in v3.0, when
most of these package defaults are moved out to modules.

Fix: #8047
This commit is contained in:
Henrik Lissner 2024-09-05 15:03:39 -04:00
parent 45310f1c3e
commit 6d9a7e9a8f
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -388,13 +388,14 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(unless hl-line-mode
(setq-local doom--hl-line-mode nil))))
(add-hook! '(evil-visual-state-entry-hook activate-mark-hook)
;; TODO: Use (de)activate-mark-hook in the absence of evil
(add-hook! 'evil-visual-state-entry-hook
(defun doom-disable-hl-line-h ()
(when hl-line-mode
(hl-line-mode -1)
(setq-local doom--hl-line-mode t))))
(add-hook! '(evil-visual-state-exit-hook deactivate-mark-hook)
(add-hook! 'evil-visual-state-exit-hook
(defun doom-enable-hl-line-maybe-h ()
(when doom--hl-line-mode
(hl-line-mode +1)))))