Subject: Re: Strange redisplay in global highlighted mode moving the scroll bar

From: Stephen Berman <[email-masked]>
Date: Mon, 16 May 2016 23:33:01 +0200

On Sat, 14 May 2016 09:42:13 +0200 Angelo Graziosi <[email-masked]> wrote:

>> If my fix is found acceptable
>
> I have tested the patch with this init.el file:
>
> ;;
> (global-hl-line-mode 1)
>
>
> and it seems to work..

I take it you mean you see no flickering?  That would confirm the patch
fixes problem you reported.  You should also see, when you make the
frame have two (or more) windows, that the current line of only the
selected window is highlighted; this is the default behavior without the
patch and should obtain with the patch as well.

> Any other configuration for testing?

The default for global-hl-line-mode, which you tested with the above, is
for the value of global-hl-line-sticky-flag to be nil; if you set it to
non-nil, then when you make the frame display two (or more) windows, the
current line is highlighted in all of them.  A difference between the
behavior of the existing version of hl-line.el and the behavior with my
patch is that, in the former, the current line of each window displaying
a different buffer becomes highlighted only as soon as that window is
selected (and remains highlighted when another window is selected),
while with my patch, the current line in all live (visible) windows is
highlighted at once.  So this is a new feature and the question is, do
you prefer this behavior to the original behavior?  (If all the windows
display the same buffer, then with non-nil global-hl-line-sticky-flag
the highlighting appears in all of them simultaneously both with and
without the patch.)

It would be helpful if you'd also test the behavior of the patch with
the buffer local hl-line-mode.  Here, the default is for the value of
hl-line-sticky-flag to be non-nil, which means that if the same buffer
is displayed in two (or more) windows of a frame, the current line is
highlighted in each of these windows, and in addtion, when you select a
window displaying a different buffer, the line in the previously
selected window (displaying the buffer in which hl-line-mode was
enabled) remains highlighted.  If you set hl-line-sticky-flag to nil,
then only the current line of the selected window is highlighted.  These
behaviors of hl-line-mode should still be the same with the patch.  But
without the patch, setting hl-line-sticky-flag to nil results in
flickering of the highlighted line when moving the scroll bar with the
mouse; with the patch, there should be no flickering.

Steve Berman