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 15:41:13 +0000 Message-ID: References: <166939872890.18950.12581667269687468681@vcs2.savannah.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> <83r0t3y6yy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4887"; 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 17:42:26 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 1pidN3-00014C-On for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Apr 2023 17:42:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pidMi-0003OQ-CH; Sat, 01 Apr 2023 11:42:04 -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 1pidMg-0003Nu-PL for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 11:42:02 -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 1pidMg-0002ao-Hn for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 11:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pidMg-0005zb-7a for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 11:42: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 15:42: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.168036367722954 (code B ref 56682); Sat, 01 Apr 2023 15:42:02 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 1 Apr 2023 15:41:17 +0000 Original-Received: from localhost ([127.0.0.1]:38401 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pidLx-0005yA-I4 for submit@debbugs.gnu.org; Sat, 01 Apr 2023 11:41:17 -0400 Original-Received: from heytings.org ([95.142.160.155]:35374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pidLv-0005y0-95 for 56682@debbugs.gnu.org; Sat, 01 Apr 2023 11:41:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1680363674; bh=IKP0Ic284WZnGhkYL3TVDHe2mpYEr5nah93hpkU0ofE=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=xfZe/c89PPTU2fykC5NWwUb/EDSyFYvmyQP9BcGs7okJXAoEZ/VzHfWeR0w1Avg4O DnXF+xdImipTGRkKWqtF3RQ8++/YaI8svGPqpk0/59g/kit6UQ1WKUm7NpFW1PnlmN 44aYL22hP9Cm1XZumzQiWSMc0Hh48bJDAMikH5g8ToBDJHfr0klvLpiP0wm1PBXWqq xer2ZokmWNUHXgD1u7Hg0+7m/P6tcLCE2g7WTRpqgH/cjzHusUXJG5DAuR1ZoexJ04 SGXgZMT5i98VgsPNuYY/pWC5kzU6ZYOJ5ChvgEgCYoqGA9+CkuwnWMPE81Y4NzBvpB 7yDSbw9qew/Nw== In-Reply-To: <83r0t3y6yy.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:259056 Archived-At: > > OK, but still: why do you need to find the buffer position at BOL, and > how is that related to cursor movement? > Well, with the improved calculation: max (bol_pos + ((pos - bol_pos) / len - 1) * len, BEGV) instead of: max ((pos / len - 1) * len, BEGV) cursor movement becomes accurate. You can see that for example in the 'long-line.xml' file, in which the cursor does not move to a "wrong" column anymore (or sometimes even to another column on the same visual line). The idea is that, instead of simply taking a position in the buffer that only depends on the value of 'pos' as a value for BEGV (with 'get_small_narrowing_begv'), we take one that is, inside a long line, relative to BOL, IOW, it is always BOL + n * len, for some n. > > FRAME_WINDOW_P is what we use all over the place, so it must be correct. > Okay, thanks. > > You are missing the case of R2L paragraphs, where the continuation glyph > is displayed on the left. > Okay, so what would be the correct calculation here? This? int width = window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS) - (WINDOW_RIGHT_FRINGE_WIDTH (w) == 0 || WINDOW_RIGHT_FRINGE_WIDTH (w) == 0 ? 1 : 0);