rolandwalker / nav-flash

Briefly highlight the current line in Emacs
28 stars 2 forks source link

No line flash on empty line #5

Open duianto opened 3 years ago

duianto commented 3 years ago

The line doesn't flash when the cursor is on an empty line.

A possible solution is implemented in Doom Emacs, by extending the nav-flash-face past the EOL. https://github.com/hlissner/doom-emacs/blob/f621ff80471e8d08a72e5ece00641c70b121873a/modules/ui/nav-flash/config.el#L44

(when (fboundp 'set-face-extend)
    (set-face-extend 'nav-flash-face t))

It would be useful for non Doom Emacs users if this was implemented in nav-flash.

Example


abc

d

(there's an empty line above abc and below the d)

The following occurs when evaluating this on each line:

(nav-flash-show)

Current behavior, without face extend

nav-flash-without-face-extend

Expected behavior, with face extend

(set-face-extend 'nav-flash-face t)

nav-flash-with-face-extend

Buffers last line issue

One issue remains on the buffers last line.

The line doesn't flash with or without extending the face.

Is there some way this could be solved?

System info

nav-flash-20191204.1427 GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26 Windows 10 Version 2004

rolandwalker commented 3 years ago

Hi!

Cool feature, let's add that!

duianto commented 3 years ago

On this page: https://stackoverflow.com/questions/9577906/fixing-emacs-hl-line-mode-for-the-last-line-of-a-buffer

This suggestion might be helpful for flashing the buffers last line when it's empty. https://stackoverflow.com/a/9787278

If you want to change hl-line-mode to also highlight the end of buffer as if it were a LF, you could that by adding a overlay with an after-string.

duianto commented 3 years ago

Or this: https://www.reddit.com/r/emacs/comments/c6cgs1/how_to_highlight_the_whole_line_when_selecting/es7wvqd/?utm_source=reddit&utm_medium=web2x&context=3

Here is a link to an example of how to create end-of-line indicators using overlays. Line containing point (including, but not limited to the line at the end of the buffer) is a thin underscore/underline from EOL to the right window edge. All other lines have pilcrow characters at the EOL. The EOL indicators can be changed to whatever floats one's boat; e.g., a solid rectangle. [The example is not a plug-in library ... it is just an example.]

https://github.com/lawlist/eol-indicator

The same concept can be applied to create the visual effect desired by the O.P. of this thread, however, some assembly is required.