"Fix" hl-line bleeding into buffer bg
When its face is remapped (e.g. by solaire-mode). Unfortunately, this means highlighting on the 2nd-to-last line becomes janky, but this is the lesser evil of the two. Upgrade to 27 people! Also, don't do anything if solaire-mode isn't enabled.
This commit is contained in:
parent
fed0e9365c
commit
86625d3d42
1 changed files with 21 additions and 14 deletions
|
@ -45,22 +45,29 @@
|
||||||
;; considered an unreal buffer, so solaire-mode must be restored.
|
;; considered an unreal buffer, so solaire-mode must be restored.
|
||||||
(add-hook 'org-capture-mode-hook #'turn-on-solaire-mode)
|
(add-hook 'org-capture-mode-hook #'turn-on-solaire-mode)
|
||||||
|
|
||||||
|
;; DEPRECATED No longer needed in Emacs 27+
|
||||||
(unless EMACS27+
|
(unless EMACS27+
|
||||||
;; On Emacs <=26, when point is on the last line and solaire-mode is
|
;; HACK On Emacs <=26, when point is on the last (or second to last) line
|
||||||
;; remapping the hl-line face, hl-line's highlight bleeds into the rest of
|
;; and solaire-mode is remapping the hl-line face, hl-line's highlight
|
||||||
;; the window after eob. On Emacs 27 this no longer happens.
|
;; bleeds into the rest of the window after eob. On Emacs 27 this no
|
||||||
|
;; longer happens. This tries to fix it for 26 users, but it imposes
|
||||||
|
;; another problem: the 2nd-to-last line will only be highlighted up to
|
||||||
|
;; the (n-1)th character, but I think that is the lesser evil.
|
||||||
(defun +doom--line-range-fn ()
|
(defun +doom--line-range-fn ()
|
||||||
|
(if solaire-mode
|
||||||
(let ((bol (line-beginning-position))
|
(let ((bol (line-beginning-position))
|
||||||
(eol (line-end-position))
|
(eol (line-end-position))
|
||||||
(pmax (point-max)))
|
(eob (point-max)))
|
||||||
(cons bol
|
(cond ((or (= bol eob)
|
||||||
(cond ((and (= eol pmax)
|
(= (1+ eol) eob))
|
||||||
(/= eol bol))
|
nil)
|
||||||
(1- eol))
|
((= eol eob)
|
||||||
((or (eobp)
|
(cons bol eol))
|
||||||
(= eol pmax))
|
((eobp)
|
||||||
eol)
|
(cons bol eol))
|
||||||
((line-beginning-position 2))))))
|
((cons bol (line-beginning-position 2)))))
|
||||||
|
(cons (line-beginning-position)
|
||||||
|
(line-beginning-position 2))))
|
||||||
(setq hl-line-range-function #'+doom--line-range-fn)
|
(setq hl-line-range-function #'+doom--line-range-fn)
|
||||||
|
|
||||||
;; HACK The fringe cannot have a buffer-local remapping on Emacs <= 26, so
|
;; HACK The fringe cannot have a buffer-local remapping on Emacs <= 26, so
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue