From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#23510: Strange redisplay in global highlighted mode moving the scroll bar Date: Wed, 11 May 2016 11:25:24 +0200 Message-ID: <8760ul9caj.fsf@gmx.net> References: <1959517970.14624161462908686797.JavaMail.httpd@webmail-60.iol.local> <83oa8dau7i.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462958786 29376 80.91.229.3 (11 May 2016 09:26:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 May 2016 09:26:26 +0000 (UTC) Cc: 23510@debbugs.gnu.org, "angelo.graziosi@libero.it" To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 11 11:26:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b0QPC-0004ji-UW for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 May 2016 11:26:11 +0200 Original-Received: from localhost ([::1]:51191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0QPC-0006ZY-31 for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 May 2016 05:26:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0QP7-0006XB-FC for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 05:26:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0QP4-0001uj-5B for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 05:26:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0QP4-0001ua-1p for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 05:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b0QP3-0000Qg-Tf for bug-gnu-emacs@gnu.org; Wed, 11 May 2016 05:26:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 May 2016 09:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23510 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23510-submit@debbugs.gnu.org id=B23510.14629587411617 (code B ref 23510); Wed, 11 May 2016 09:26:01 +0000 Original-Received: (at 23510) by debbugs.gnu.org; 11 May 2016 09:25:41 +0000 Original-Received: from localhost ([127.0.0.1]:46687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0QOj-0000Q0-8w for submit@debbugs.gnu.org; Wed, 11 May 2016 05:25:41 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:53899) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0QOh-0000Po-Kn for 23510@debbugs.gnu.org; Wed, 11 May 2016 05:25:40 -0400 Original-Received: from rosalinde ([89.245.116.29]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MfAog-1bFB401Rve-00OlM8; Wed, 11 May 2016 11:25:26 +0200 In-Reply-To: <83oa8dau7i.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 11 May 2016 11:13:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) X-Provags-ID: V03:K0:0gAlh0yyGpqN37HgRzAueIYI4DUgimkU85KA6Xl9KV/AA1fOE+M eVNJz0BU+ZdqQL6LcZK5S1w9Xk49GCp/8thkmgzrKOlefXAqy7hnzWA8ZzieI8Pzg0shjDX 4SaM6wGFK2T9UcKlkdRrR4HVUgEpWS27cPH+ycxCsYUJllgmS9OUNn1ivbuTABs1eI9gnkO XqHNlMKNnDHbH3LZMpgLA== X-UI-Out-Filterresults: notjunk:1;V01:K0:AYqMEgYFZT0=:1O7s8vvOipIRRwD2XGIxwI ajkRwDAZeRd7UKipKaL7YcTXqg622uJJgUpDIbzLd3VUlhmqCRRuroAPIuk52bcj41YPguljc Gs7a17v6f1WbuVkZ52lF4ANjdHER4yGF7jRjd6dFs3Tf4tJ+lhqFVF5rLkyFXBVAw2Boy8G7P EAq2mmNPYW+y8or5Dk3W1hFpPsVxRUVwFtMDlgXQqmdLSNquPwi/3NPl4zCELVvtNAXiWghL7 Y+RRcYhhYs9OdfgtKwcr3+3mYsg4szweE7ebRyCyBRKsDn0rXiv1yJTCxwdsxRoNOTgz15TOS 32jE2WcXTkRpYtyXx4LKfJc/S1nSsCLp2HfFfZjN96447qdpWlGRwlzRnDY6vT84HCXjtGdi6 bO0KjoAxqPvxaAOwlw1yELlmaTJdGfTMDYlaiWqTwNX82vwp2oYl920QTau0Ar9VY8a0CRseg XnHRIo6eKVczv6nbGnzKqGAFq0W1qaWhkrJg5a49HK3wjMl80SRSOJ7I5tawRmqfHtTV5wOHy LBTMfa2phbo+4A6ij1Cdex2XeTemQce5G9pa/eBvVbOuhj99NJ5JJM4kJRDd4ifi5xfC4rZ9r lSUbPq0EdJJVC1Hf0UepPN6VK0sgpW/zuPjLW7fyVqJqK7ZBuFeoeEsjMBprleZjtM4eEicfs 8w6l1J/rdZp1R5d1jUUFEVuaZWZrk4JO9kYbhsDAcqdt7PHDeotMUwF5cuXYB2LUWMvVSFRwW Y6PbocslRNM+FO8Zhu2/GtFKMR0xsWyrRRGjVQGskVWeibJwiVII2WQRNvYG779PQJ7UbAzj X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118105 Archived-At: On Wed, 11 May 2016 11:13:05 +0300 Eli Zaretskii wrote: >> Date: Tue, 10 May 2016 21:31:26 +0200 (CEST) >> From: "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