From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56682: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing. Date: Sat, 01 Apr 2023 18:09:41 +0300 Message-ID: <83r0t3y6yy.fsf@gnu.org> References: <166939872890.18950.12581667269687468681@vcs2.savannah.gnu.org> <94821a0ef100102ac9e0@heytings.org> <83bkmdz04y.fsf@gnu.org> <43562d4dd9dffd81938f@heytings.org> <83357ozhx0.fsf@gnu.org> <83wn4zurit.fsf@gnu.org> <83bkmaueib.fsf@gnu.org> <83357fnwyy.fsf@gnu.org> <83ttzsk6v4.fsf@gnu.org> <83wn4le8s3.fsf@gnu.org> <0f053182b02103503c26@heytings.org> <83pmaccnz7.fsf@gnu.org> <0f053182b04357300cb1@heytings.org> <83lel0chku.fsf@gnu.org> <0f053182b00a59a41caa@heytings.org> <835yc3cdhk.fsf@gnu.org> <9e9ed8043fc8bfe49bfe@heytings.org> <83h6vnaukn.fsf@gnu.org> <9e9ed8043f4ff9316461@heytings.org> <83k00exj56.fsf@gnu.org> <10ececa33f0a4af46fd2@heytings.org> <83edp3zwjk.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13425"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.org, monnier@iro.umontreal.ca To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 01 17:10:19 2023 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 1picry-0003M0-Tv for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Apr 2023 17:10:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1picrl-0004pf-QS; Sat, 01 Apr 2023 11:10:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1picrk-0004pJ-1V for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 11:10:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1picri-0002K3-Ca for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 11:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1picrh-0005DO-Nu for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 11:10:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Apr 2023 15:10: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.168036177320005 (code B ref 56682); Sat, 01 Apr 2023 15:10:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 1 Apr 2023 15:09:33 +0000 Original-Received: from localhost ([127.0.0.1]:38388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1picrF-0005Ca-5H for submit@debbugs.gnu.org; Sat, 01 Apr 2023 11:09:33 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1picrD-0005CK-7H for 56682@debbugs.gnu.org; Sat, 01 Apr 2023 11:09:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1picr7-0002Ge-5B; Sat, 01 Apr 2023 11:09:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PcQpWPNsy2QQkIPB24fJne0O75yTmobiTl3PUlYdvJQ=; b=V8pupR3ZQ4Tz LYwqVrpVzgLcygHX7Iw7ZzA5VozPA9SRLOxDJjeXO0sKh1ToJaaUh43d5pK0ytZ5bul2jh8+nuNYZ wGsCF+/yFigxXGFz5LgEkKx4D2w3cZ6k3UbXCCxxG3q8e6NGUjJLAAgDJ5IAGo5WZeLLxe2aLrm3f yOpapTcGDuSfYVhykdFVeo21dF/gBjrnCosjV72jkN28+p9fB7ooTQIulKdCZScA3SIuPAICBLr5L uneojSBFkRfsatzF1q7y4Dp/O6xkgFHUm0sQoFO5PgLw7I2ovasIkki3ABYuMe91Ru73SM3peTt35 LNvEBnh0l2A75MVDlWjpEg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1picr6-0006K0-Lj; Sat, 01 Apr 2023 11:09:24 -0400 In-Reply-To: (message from Gregory Heytings on Sat, 01 Apr 2023 14:26:50 +0000) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259055 Archived-At: > Date: Sat, 01 Apr 2023 14:26:50 +0000 > From: Gregory Heytings > cc: 56682@debbugs.gnu.org, monnier@iro.umontreal.ca > > > . I'm not sure I'm happy about calling find_newline in a loop where > > previous code just made a trivial calculation. Imagine a buffer with a > > lot of short lines. What problem exactly is being solved here, and how > > does this change solve it? > > > > The point is to find the buffer position of BOL. But you're right, there > is a missed optimization here, which I just added (also in dce08cf05c). > Now the code searches for that position in [pos-500..pos], > [pos-5500..pos-500], [pos-55500..pos-5500], [pos-555500..pos-55500], in > that order, and buffers with lots of short lines (or more precisely: > buffers with lots of short lines _and_ one or more long lines) are not > negatively affected by that code anymore. OK, but still: why do you need to find the buffer position at BOL, and how is that related to cursor movement? > > . Why such a strange method of finding out whether we are on a TTY > > frame? The usual method is FRAME_WINDOW_P (XFRAME (w->frame)). > > > > That's what I've been using since that function was introduced six months > ago or so. I admit I don't remember why that's what I chose. If you tell > me that using FRAME_WINDOW_P (XFRAME (w->frame)) has the same effect as > terminal-live-p == t (and indeed after looking at the code ISTM that > that's the case), I'll replace that. FRAME_WINDOW_P is what we use all over the place, so it must be correct. > > . The continuation glyph can be present not only on TTY frames, but also > > on GUI frames when one or both of the fringes are disabled, so the test > > needs to be augmented. I think you need to use WINDOW_LEFT_FRINGE_WIDTH > > and WINDOW_RIGHT_FRINGE_WIDTH. > > > > Thanks, I did not realize that. I just did that (again in dce08cf05c), > but I'm not sure how WINDOW_LEFT_FRINGE_WIDTH should be used. Using > WINDOW_RIGHT_FRINGE_WIDTH seems enough, but I'm probably missing > something. You are missing the case of R2L paragraphs, where the continuation glyph is displayed on the left.