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: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing. Date: Sat, 01 Apr 2023 14:26:50 +0000 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4775"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56682@debbugs.gnu.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 Apr 01 16:27:12 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 1picCG-000173-2V for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Apr 2023 16:27:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1picC9-00042s-3n; Sat, 01 Apr 2023 10:27: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 1picC7-00042e-FQ for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 10:27:03 -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 1picC7-0004DE-7j for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 10:27:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1picC6-0003v9-Bz for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 10:27:02 -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, 01 Apr 2023 14:27:02 +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.168035921415053 (code B ref 56682); Sat, 01 Apr 2023 14:27:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 1 Apr 2023 14:26:54 +0000 Original-Received: from localhost ([127.0.0.1]:38369 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1picBx-0003ui-PN for submit@debbugs.gnu.org; Sat, 01 Apr 2023 10:26:54 -0400 Original-Received: from heytings.org ([95.142.160.155]:35286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1picBv-0003uZ-Uf for 56682@debbugs.gnu.org; Sat, 01 Apr 2023 10:26:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1680359210; bh=SDz+GAToHnrZp+JrXYN3xJvvujJ+XKHBNcC4kLncgus=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=A6OesTC6AJ6CHj36tzD/Cc8An/BpRjDVGrUx+3NRh1VQ9+O/zINsqfitDXKMIHs7g ceWanE0vxAYSGSfSovb5EAG+fpo7xYmrjD92Xl/NbpYtl4mzfjenk5kehA9dYHzQOE g0x5QOYlrZKkSPbtaibDFRYu0Sm4+rkNySO+DnLDglm+d5zcS2TCvlYK9z6lbhPJGh uV5Qmseu47iyBEb79kdIIa3THjxxNvCOQ+bwa9Ewio5In/dMib09gy/S1qJpFDJGO9 msXM/UyvZ87xiSWsbIgjxarDAudUIAzEA/8DiBLTchadJf3ff27AXSZ8aEJcp1sE5O 2J62VldZ/GubQ== In-Reply-To: <83edp3zwjk.fsf@gnu.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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259054 Archived-At: Thanks for your review! > > They also change the code in non-trivial ways, and I'm not thrilled > about changing code in those parts at this late stage. > Two commits do change the code, yes, to fix (cursor motion command with C-n / C-p) bugs. That code is only used for buffers with long lines. It would be most regrettable to release Emacs 29 without these bugs fixed. > > Specific comments: > > afc2c6c13c: > > . Misses an optimization opportunity: where pos == BEGV, you can use > BEGV_BYTE instead of calling CHAR_TO_BYTE. > Okay, thanks, added in dce08cf05c. > > . 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. > > 2093e010dc: > > . 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. > > . 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.