From: Stephen Berman <stephen.berman@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23510@debbugs.gnu.org,
"angelo.graziosi@libero.it" <angelo.graziosi@libero.it>
Subject: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar
Date: Wed, 11 May 2016 11:25:24 +0200 [thread overview]
Message-ID: <8760ul9caj.fsf@gmx.net> (raw)
In-Reply-To: <83oa8dau7i.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 11 May 2016 11:13:05 +0300")
On Wed, 11 May 2016 11:13:05 +0300 Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Tue, 10 May 2016 21:31:26 +0200 (CEST)
>> From: "angelo.graziosi@libero.it" <angelo.graziosi@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.
What you say about the use of pre- and post-command-hook and moving
overlays may well be (perhaps the main) part of the problem here, but I
found out that there's an specific condition inducing it: I noticed that
the flickering only happens when global-hl-line-mode is enabled, but not
when hl-line-mode is enabled, and it turns out that the crucial
difference between them is that in the former,
global-hl-line-sticky-flag is nil by default, while in the latter,
hl-line-sticky-flag is t by default: when I set
global-hl-line-sticky-flag to t and then enable global-hl-line-mode, the
flickering no longer happens, and when I set hl-line-sticky-flag to nil
and then enable hl-line-mode, the flickering does happen.
Steve Berman
next prev parent reply other threads:[~2016-05-11 9:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 19:31 bug#23510: Strange redisplay in global highlighted mode moving the scroll bar angelo.graziosi
2016-05-11 8:13 ` Eli Zaretskii
2016-05-11 9:25 ` Stephen Berman [this message]
2016-05-11 9:44 ` Eli Zaretskii
2016-05-12 20:41 ` Stephen Berman
2016-05-12 20:41 ` Stephen Berman
2016-05-13 17:20 ` Stephen Berman
2016-05-13 17:52 ` Stephen Berman
2016-05-14 7:42 ` Angelo Graziosi
2016-05-16 21:33 ` Stephen Berman
2016-05-16 22:28 ` Angelo Graziosi
2016-05-25 22:13 ` Angelo Graziosi
2016-05-26 2:44 ` Eli Zaretskii
2016-05-26 9:34 ` Stephen Berman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8760ul9caj.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--cc=23510@debbugs.gnu.org \
--cc=angelo.graziosi@libero.it \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).