From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#25751: Query replace lazy highlighting Date: Fri, 17 Feb 2017 08:37:26 +0200 Message-ID: <83d1ehxqzd.fsf@gnu.org> References: <87mvdmxoig.fsf@lambda> <87wpcpx32v.fsf@localhost> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1487313501 9844 195.159.176.226 (17 Feb 2017 06:38:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 17 Feb 2017 06:38:21 +0000 (UTC) Cc: 25751@debbugs.gnu.org, antoine.levitt@gmail.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 17 07:38:16 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cecBH-0001uR-RL for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Feb 2017 07:38:11 +0100 Original-Received: from localhost ([::1]:51795 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cecBN-0005cF-IX for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Feb 2017 01:38:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cecBB-0005ay-EE for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 01:38:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cecB8-0000Pe-AZ for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 01:38:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44776) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cecB8-0000PU-7G for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 01:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cecB8-0006zT-1W for bug-gnu-emacs@gnu.org; Fri, 17 Feb 2017 01:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Feb 2017 06:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25751 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25751-submit@debbugs.gnu.org id=B25751.148731343226817 (code B ref 25751); Fri, 17 Feb 2017 06:38:01 +0000 Original-Received: (at 25751) by debbugs.gnu.org; 17 Feb 2017 06:37:12 +0000 Original-Received: from localhost ([127.0.0.1]:42975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cecAK-0006yS-CV for submit@debbugs.gnu.org; Fri, 17 Feb 2017 01:37:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54795) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cecAI-0006yF-Qf for 25751@debbugs.gnu.org; Fri, 17 Feb 2017 01:37:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cecA9-00089n-2s for 25751@debbugs.gnu.org; Fri, 17 Feb 2017 01:37:05 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cecA8-00089d-Vd; Fri, 17 Feb 2017 01:37:01 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3093 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cecA8-0000Hy-4k; Fri, 17 Feb 2017 01:37:00 -0500 In-reply-to: <87wpcpx32v.fsf@localhost> (message from Juri Linkov on Thu, 16 Feb 2017 23:01:28 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:129439 Archived-At: > From: Juri Linkov > Date: Thu, 16 Feb 2017 23:01:28 +0200 > Cc: 25751@debbugs.gnu.org > > > (setq lazy-highlight-initial-delay 0) (shouldn't it be default by the > > way, at least on graphical displays?) reduces the problem but does not > > eliminate it (it produces small flickers). There's > > lazy-highlight-cleanup, but that disables cleanup completely, which I > > don't want. > > > > Can't this be eliminated? > > The reason why it works this way is because lazy-highlight is not yet > optimized to handle changes: it needs to dehighlight the replaced text, > and to add highlighting in the new replacing text after every replacement. > I see no simpler solution than to write a new function with a name like > ‘isearch-lazy-highlight-update-in-region’ that given the region boundaries > of the last replacement will rehighlight matches in that region. I think the problem is not that we remove the highlight and add it anew, the problem is that there's a redisplay cycle in between the removal and the following addition. The fact that setting lazy-highlight-initial-delay alleviates the problem to some extent, but still leaves the flicker tells me that there's a call to sit-for or some such somewhere in the code that processes replacements, and the removal and addition of the highlight are on two different sides of that sit-for call. One possible solution would be to remove the highlight and add it without triggering redisplay, then I'd expect the flicker to go away. Does this make sense?