[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23510: Strange redisplay in global highlighted mode moving the scrol

From: Eli Zaretskii
Subject: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar
Date: Wed, 11 May 2016 11:13:05 +0300

> Date: Tue, 10 May 2016 21:31:26 +0200 (CEST)
> From: "address@hidden" <address@hidden>
> (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.,

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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]