`hl-line` extends to the end of the buffer

:warning: This issue only applies to Emacs 26.x and older (a version that Doom Emacs no longer supports). It is obsolete, but is kept for posterity.

This happens when:

  • The hl-line face is remapped using the face-remap library (which solaire-mode does; which Doom enables by default),
  • You are on Emacs 26.x,
  • And your cursor is at the end of the last line of the buffer.

This is due to a bug in how Emacs 26 handles remapped faces at EOB (end-of-buffer). The solaire-mode package has remapped the hl-line face to solaire-hl-line-face.

There are two workarounds for this:

  1. Upgrade to Emacs 27. This is the recommended option, because Doom Emacs will soon drop 26.x support sometime mid-2021, and 27.1 simply runs faster and more stable.

  2. Disable solaire-mode:

    ;; ~/.doom.d/packages.el
    (package! solaire-mode :disable t)