GNU bug report logs -
#23510
Strange redisplay in global highlighted mode moving the scroll bar
Previous Next
Full log
Message #8 received at 23510 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 10 May 2016 21:31:26 +0200 (CEST)
> From: "angelo.graziosi <at> libero.it" <angelo.graziosi <at> libero.it>
>
> (global-hl-line-mode 1)
>
>
> Now, in the scratch buffer, copy and paste many times its text (;; This
> buffer...) so that the scratch buffer has many lines, not all contained in the
> Emacs window/frame. Move the cursor on a line, more or less at the center of
> the window. The line is highlighted (in green, by default). Now move slowly
> up/down the scroll bar, then the highlighted line seems to flicker as if it
> were redrawn at (almost) each pixel movement of the scroll bar.
>
> Is this to be expected?
I think so. HL-Line mode works by hooking both pre-command-hook and
post-command-hook; it removes its highlight overlay in the former and
reapplies it in the latter. When you move the scroll-bar thumb, the
hooks are called several times (at least twice) per mouse drag event,
and since Emacs tracks the mouse moves at pixel granularity, you
usually have much more calls to the hooks. The result is constant
redrawing of the highlighted line, and that causes flickering.
> Other software with same feature do not show this
> "flickering" and the highlight moves synchronously with the text.
To reduce the number of redraws, hl-line.el should switch to a
different method of moving the overlay, I think. I didn't try, so I
cannot be sure this is doable with the existing facilities, but
someone who is motivated enough should try using, e.g.,
pre-redisplay-function.
It could also be that hl-line should be smarter, and refrain from
removing and reapplying the overlay if point didn't move, or stays
within the same screen line. Again, I didn't try that, so perhaps it
won't work for some reason.
This bug report was last modified 8 years and 364 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.