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#9034: point adjustment (with invisible text) moves to the next line Date: Wed, 25 Aug 2021 19:43:34 +0300 Message-ID: <834kbdv5jd.fsf@gnu.org> References: <87iprb38sa.fsf@gmail.com> <87tujd32pc.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12387"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry.kurochkin@gmail.com, 9034@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 25 18:44:09 2021 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 1mIw0X-00030n-7p for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Aug 2021 18:44:09 +0200 Original-Received: from localhost ([::1]:44010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIw0V-00078m-Ki for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Aug 2021 12:44:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIw0Q-00078e-0d for bug-gnu-emacs@gnu.org; Wed, 25 Aug 2021 12:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35969) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIw0P-0007FU-OX for bug-gnu-emacs@gnu.org; Wed, 25 Aug 2021 12:44:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mIw0P-000736-MG for bug-gnu-emacs@gnu.org; Wed, 25 Aug 2021 12:44: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: Wed, 25 Aug 2021 16:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9034 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 9034-submit@debbugs.gnu.org id=B9034.162990982727068 (code B ref 9034); Wed, 25 Aug 2021 16:44:01 +0000 Original-Received: (at 9034) by debbugs.gnu.org; 25 Aug 2021 16:43:47 +0000 Original-Received: from localhost ([127.0.0.1]:47515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIw0B-00072W-II for submit@debbugs.gnu.org; Wed, 25 Aug 2021 12:43:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mIw07-00072I-Qq for 9034@debbugs.gnu.org; Wed, 25 Aug 2021 12:43:47 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53388) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIw02-0006zy-Hd; Wed, 25 Aug 2021 12:43:38 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1283 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 1mIw02-0004nq-4h; Wed, 25 Aug 2021 12:43:38 -0400 In-Reply-To: <87tujd32pc.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 25 Aug 2021 18:32:15 +0200) 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:212659 Archived-At: > From: Lars Ingebrigtsen > Date: Wed, 25 Aug 2021 18:32:15 +0200 > Cc: 9034@debbugs.gnu.org > > Also as previously noted, if Vglobal_disable_point_adjustment is on, > then this doesn't happen, so the problem almost has to be here: > > command_loop_1 > ... > if (current_buffer == prev_buffer > && XBUFFER (XWINDOW (selected_window)->contents) == current_buffer > && last_point_position != PT > && NILP (Vdisable_point_adjustment) > && NILP (Vglobal_disable_point_adjustment)) > { > if (last_point_position > BEGV > && last_point_position < ZV > && (composition_adjust_point (last_point_position, > last_point_position) > != last_point_position)) > /* The last point was temporarily set within a grapheme > cluster to prevent automatic composition. To recover > the automatic composition, we must update the > display. */ > windows_or_buffers_changed = 21; > if (!already_adjusted) > adjust_point_for_property (last_point_position, > MODIFF != prev_modiff); > } > > I haven't tried to debug any further -- is it obvious to anybody what's > failing here, by any chance? :-) This code is chock-full of questionable heuristics, and in particular tries to guess in which direction to move point out of the invisible text. The results are sometimes surprising. The upside is that it "mostly works". But if someone can come up with a better heuristics, I'm all ears.