From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56682: Fix the long lines font locking related slowdowns Date: Sat, 30 Jul 2022 13:31:42 +0000 Message-ID: <65cb7c73fdf6704d19d5@heytings.org> References: <83bktghrn0.fsf@gnu.org> <8a3eaeef010995a5da8d@heytings.org> <837d40ds09.fsf@gnu.org> <83zggwcby5.fsf@gnu.org> <83o7xccagi.fsf@gnu.org> <831qu7daxb.fsf@gnu.org> <83sfmnb7yg.fsf@gnu.org> <837d3ybh5z.fsf@gnu.org> <136c4fe0fc74196714aa@heytings.org> <83pmhp89ov.fsf@gnu.org> <136c4fe0fc39573addc9@heytings.org> <83k07x8738.fsf@gnu.org> <136c4fe0fcdf00ef9a11@heytings.org> <83h73183r7.fsf@gnu.org> <136c4fe0fc0fceb0d752@heytings.org> <838roc8ka7.fsf@gnu.org> <83tu706obt.fsf@gnu.org> <83h7306ifa.fsf@gnu.org> <83edy37pul.fsf@gnu.org> <83pmhn55sk.fsf@gnu.org> <65cb7c73fdc753518d35@heytings.org> <83fsii68o3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jxZl0f7F6C" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26963"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 30 15:32:22 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oHmZp-0006pq-T2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jul 2022 15:32:21 +0200 Original-Received: from localhost ([::1]:50212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oHmZo-000238-Di for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jul 2022 09:32:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oHmZW-00022s-0t for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 09:32:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oHmZV-0004LN-OM for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 09:32:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oHmZV-0001je-Jn for bug-gnu-emacs@gnu.org; Sat, 30 Jul 2022 09:32:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Jul 2022 13:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.16591879066646 (code B ref 56682); Sat, 30 Jul 2022 13:32:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 30 Jul 2022 13:31:46 +0000 Original-Received: from localhost ([127.0.0.1]:34357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHmZF-0001j8-Ob for submit@debbugs.gnu.org; Sat, 30 Jul 2022 09:31:45 -0400 Original-Received: from heytings.org ([95.142.160.155]:59206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oHmZD-0001j0-Ro for 56682@debbugs.gnu.org; Sat, 30 Jul 2022 09:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1659187902; bh=Ysbe1UPXvYdDggokFunViqiDYiAJxTp5vRM9xE1Neh4=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=3ovi2j7ccihe9JWm+C61AQHEo8TjWciL6TTENXaR2NXz0ZX+i3/AuYte1P0yq4T3d cqfhHoogEceWAyfNMKcrNqOCEtVaUMG8lMJ80I4MAlqfu/qCDKOQKWQ7hvciWFboyf WRPgi75VZvmkSNFZCBhTFpJ8GHxDTvWLcBr/sPG/g4h8jsYKYyAu8TkA/S0fbVjnzZ 8XdXMzPkXmx4nl66RrtIX8U7iXngghAo6BDEc4Hi7NQJ6Txw1lZRQQRZLJ/r+tRjNx tdrrKs9Ei24zW/jmniWn5nIpHJ3QkjW9dQxKG3W4W+cjBTHd6/AjrILP7qWG3bF14+ Kf6usn6i1hCeQ== In-Reply-To: <83fsii68o3.fsf@gnu.org> Content-ID: <65cb7c73fd04334cbdab@heytings.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:238279 Archived-At: --jxZl0f7F6C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-ID: <65cb7c73fd13f1a9bc7e@heytings.org> > > And I've found the culprit: we weren't restoring point after lifting the= =20 > locked narrowing. narrow-to-region can move point if the new=20 > restriction puts point outside of the region. So what was happening is= =20 > that isearch-update was calling pos-visible-in-window-group-p to see=20 > whether the match is visible, and that call would move point from under= =20 > the feet of isearch-update, because pos-visible-in-window-p calls=20 > display routines. So any subsequent uses of point would use a=20 > completely wrong value of point. > > I've now made narrow-to-region preserve point across locked narrowing,=20 > and the problem went away. > > Ugh! this one was a bitch to debug! > =F0=9F=98=89 Thanks, that's even better! So the only remaining question is whether it is necessary to recompute=20 narrowed_begv and narrowed_zv in init_iterator: diff --git a/src/xdisp.c b/src/xdisp.c index b1ee7889d4..e415320a52 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3429,6 +3429,12 @@ init_iterator (struct it *it, struct window *w, { it->narrowed_begv =3D get_narrowed_begv (w, window_point (w)); it->narrowed_zv =3D get_narrowed_zv (w, window_point (w)); + if (charpos >=3D 0 + && (charpos < it->narrowed_begv || charpos > it->narrowed_zv)) + { + it->narrowed_begv =3D get_narrowed_begv (w, charpos); + it->narrowed_zv =3D get_narrowed_zv (w, charpos); + } } --jxZl0f7F6C--