GNU bug report logs - #79787
31.0.50; Unexpected point adjustment when passing over text that has 'invisible property and an overlay with 'display on top

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Ihor Radchenko <yantar92@HIDDEN>; Done: Eli Zaretskii <eliz@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 16 Nov 2025 15:12:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 10:12:13 2025
Received: from localhost ([127.0.0.1]:45659 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKeQG-0004py-TH
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 10:12:13 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:49814)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vKeQE-0004pf-DS
 for 79787 <at> debbugs.gnu.org; Sun, 16 Nov 2025 10:12:11 -0500
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 <eliz@HIDDEN>)
 id 1vKeQ8-0003Dq-Hb; Sun, 16 Nov 2025 10:12:04 -0500
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=ep3I+1Tb/3864liV9y8iwzmHmnzUGwywfBISJ+4M+Sw=; b=JGqXfEgSzdI2
 tvl/y9THuWl9iot2A/XwWb/wJJsHBiRY3N9rNWN8OGtk5CVOeULaJwGOMxSd86zZGRHEsJhbxVwkn
 dF6/iGbdled/WEGIxKfBHOsdKBEy6ybwwhvQ0RjWa+Lcl1lY3LTXYeNVIXj6dVzaUDUyZLrLRvs9F
 yhzSXOYg0Pztb+qBPLs9lD50KCH4iDtgb8X92lAyLxm7UrxEhICymIozlMMDEQ7ME2ZkmSOZpQWez
 Abvy3w9FVa6xJdE5I2hwY/agkWfpuCOIROwlLH6+vWshggWDA0oGlLokz4hn50lUjXedu8301u28o
 F9V3lEfdGxfoRmaiutmKsQ==;
Date: Sun, 16 Nov 2025 17:12:01 +0200
Message-Id: <86y0o6ko5a.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87qztyggrj.fsf@localhost> (message from Ihor Radchenko on Sun,
 16 Nov 2025 15:05:29 +0000)
Subject: Re: bug#79787: 31.0.50; Unexpected point adjustment when passing
 over text that has 'invisible property and an overlay with 'display on top
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN> <87tsyui5g7.fsf@localhost>
 <86a50mm4y1.fsf@HIDDEN> <87346ehwve.fsf@localhost>
 <86346em35p.fsf@HIDDEN> <87qztyggrj.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: monnier@HIDDEN, 79787 <at> debbugs.gnu.org
> Date: Sun, 16 Nov 2025 15:05:29 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> >> What about the modified reproducer I provided?
> >> You will still get the "jumpy" cursor behavior over the visible "!".
> >
> > Why do you think that's a problem?
> 
> Because the cursor behavior is unexpected. From the point of view of
> users, it should not matter whether display/invisible combination is
> caused by overlays or just by text properties.

How it is more unexpected than the jump across invisible text, or
across a display string?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 16 Nov 2025 15:05:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 10:05:37 2025
Received: from localhost ([127.0.0.1]:45601 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKeJt-0004UI-GU
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 10:05:37 -0500
Received: from mout01.posteo.de ([185.67.36.65]:33361)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>)
 id 1vKeJr-0004Tz-Qi
 for 79787 <at> debbugs.gnu.org; Sun, 16 Nov 2025 10:05:36 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id A25B0240027
 for <79787 <at> debbugs.gnu.org>; Sun, 16 Nov 2025 16:05:29 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
 t=1763305529; bh=sHaDMpZN5VzonI1eYTETIvZPDgkBei4Bzk2r0bfNsog=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=pCP87EXW7CoX82/FuHK4Iv9uTBCH2f67U9F050kutUerzSn2S3IJCKLHMxwqLYECY
 2wpwf4W5/CZI8yTACuuiik4QVdfMEWijDKefd3W73uNSXsSxwEXN1G6N5UolgNgbA4
 SQf7JH1Z4S7bOOA4eAtBCNMLI0dh0rx4RZU4C7ylmCaz1bYvgyA44mMusLrKsjuJRW
 0oJTDbVflYFoATRjq+EK3waQiX0iNSuR4x/RGqTtOrSp4S7YsWzhc5XdBVOHs/uby2
 0DrLxlE1rn7sCil/u8XiWAlPHIcr8sCn5urVSWO/3pshaCNj9xTxv/WUaJjINTt9Yu
 J9v/l36HYT7og==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4d8Z1h3kvrz9rwn;
 Sun, 16 Nov 2025 16:05:28 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79787: 31.0.50; Unexpected point adjustment when passing
 over text that has 'invisible property and an overlay with 'display on top
In-Reply-To: <86346em35p.fsf@HIDDEN>
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN> <87tsyui5g7.fsf@localhost>
 <86a50mm4y1.fsf@HIDDEN> <87346ehwve.fsf@localhost>
 <86346em35p.fsf@HIDDEN>
Date: Sun, 16 Nov 2025 15:05:29 +0000
Message-ID: <87qztyggrj.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:
>> What about the modified reproducer I provided?
>> You will still get the "jumpy" cursor behavior over the visible "!".
>
> Why do you think that's a problem?

Because the cursor behavior is unexpected. From the point of view of
users, it should not matter whether display/invisible combination is
caused by overlays or just by text properties.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 16 Nov 2025 15:02:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 10:02:38 2025
Received: from localhost ([127.0.0.1]:45587 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKeGz-0004Is-PF
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 10:02:38 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:60304)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vKeGx-0004IY-7s
 for 79787 <at> debbugs.gnu.org; Sun, 16 Nov 2025 10:02:35 -0500
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 <eliz@HIDDEN>)
 id 1vKeGr-0001CU-RX; Sun, 16 Nov 2025 10:02:29 -0500
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=HlyQeIevRCCwoiOl1nZbybjZ0BdEy+UEodkMSl3kYuU=; b=PDk+fVpW6796
 wYvSzxGUiBzF5lm2VplXA/SooSvTnn3GtniEgm/4gvafKUpsPb1omRiFXJDJytnqdTKXNJKeyduiP
 5/boBzClRzLkZPhG2Lq3VzooReNLfVGxNWGkNkNJvilzjCwVPKrX61n3cX8SZ5ujiJZvP0hrgA58X
 b0ZBeTec2pg8YcKls8VCBbmJ3QjWyggv+nsZEdAi0OHAINASChFRlDDTRl+xgDcUxU4kCrBku/Hyf
 V1fVr8YskOdmx7uWgVtdsIHLmV33bjS0ltrJb05TRsapJgvX2euA/DsR92TtGls9cI6tWBIzhxH65
 +AD6cqQ7qgXQCdskXQw6cQ==;
Date: Sun, 16 Nov 2025 17:02:26 +0200
Message-Id: <86346em35p.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87346ehwve.fsf@localhost> (message from Ihor Radchenko on Sun,
 16 Nov 2025 14:32:13 +0000)
Subject: Re: bug#79787: 31.0.50; Unexpected point adjustment when passing
 over text that has 'invisible property and an overlay with 'display on top
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN> <87tsyui5g7.fsf@localhost>
 <86a50mm4y1.fsf@HIDDEN> <87346ehwve.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: monnier@HIDDEN, 79787 <at> debbugs.gnu.org
> Date: Sun, 16 Nov 2025 14:32:13 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > So I don't think that case is relevant, but if you can come up with an
> > example of any problems in the case of text properties, please show
> > it.
> 
> What about the modified reproducer I provided?
> You will still get the "jumpy" cursor behavior over the visible "!".

Why do you think that's a problem?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787-done <at> debbugs.gnu.org:


Received: (at 79787-done) by debbugs.gnu.org; 16 Nov 2025 14:40:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 09:40:29 2025
Received: from localhost ([127.0.0.1]:45266 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKdvZ-0003Hu-Cx
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 09:40:29 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:40186)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vKdvW-0003Ho-Ss
 for 79787-done <at> debbugs.gnu.org; Sun, 16 Nov 2025 09:40:27 -0500
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 <eliz@HIDDEN>)
 id 1vKdvR-0004SH-9I; Sun, 16 Nov 2025 09:40:21 -0500
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=A4M3SMs7qnaVN27qbR8YbPW7uah/dF+fgL2hmhO0hDc=; b=Jb1RXs02sbKH
 dru5fUuwzm6+m9bs0PJgNnj6PJebFjAUW5EST+EUGJbenut9cWbADlYRDkvlNQJKu8T+NLg3pOhy4
 fV4vXQHuIhl9GixyOVCr2Lg0jsv4OrEliFzzAvdvh0bBcJU5ooywduk4sZEBaqCJdTjM+iROyBtTh
 ModUuEQCjhqHaDvgsHkAlzAuNEEEeQzNDD6WowqyhmTBtYKEFZuj2QShPrw+oUQbVNA5TzAJR7kJR
 7j5FMOMiQckoZ34tD0xD3nng5WzxBOvmSXpmRu2Fp5vtox2VZ0+QtcPE6CA+6YZAW8xB4rg2YIEjN
 752sAXx38Pu4HR9oRRRVSw==;
Date: Sun, 16 Nov 2025 16:40:18 +0200
Message-Id: <864iqum46l.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: yantar92@HIDDEN
In-Reply-To: <86a50mm4y1.fsf@HIDDEN> (message from Eli Zaretskii on Sun, 16
 Nov 2025 16:23:50 +0200)
Subject: Re: bug#79787: 31.0.50;
 Unexpected point adjustment when passing over text that has
 'invisible property and an overlay with 'display on top
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN> <87tsyui5g7.fsf@localhost> <86a50mm4y1.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787-done
Cc: 79787-done <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
> Date: Sun, 16 Nov 2025 16:23:50 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Ihor Radchenko <yantar92@HIDDEN>
> > Cc: monnier@HIDDEN, 79787 <at> debbugs.gnu.org
> > Date: Sun, 16 Nov 2025 11:26:56 +0000
> > 
> > Eli Zaretskii <eliz@HIDDEN> writes:
> > 
> > > Scratch that and use the improved patch below, which also fix3es the
> > > original recipe.
> > >
> > > diff --git a/src/keyboard.c b/src/keyboard.c
> > 
> > Works for me. Both with my recipe and with the original bug report for
> > Org mode.
> 
> Thanks, will install shortly.

Now installed on the master branch, and closing the bug.




Notification sent to Ihor Radchenko <yantar92@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Eli Zaretskii <eliz@HIDDEN>:
You have taken responsibility. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 16 Nov 2025 14:32:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 09:32:23 2025
Received: from localhost ([127.0.0.1]:45198 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKdni-0002wc-QI
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 09:32:23 -0500
Received: from mout01.posteo.de ([185.67.36.65]:57333)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>)
 id 1vKdng-0002wP-G6
 for 79787 <at> debbugs.gnu.org; Sun, 16 Nov 2025 09:32:21 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id C52F6240028
 for <79787 <at> debbugs.gnu.org>; Sun, 16 Nov 2025 15:32:13 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
 t=1763303533; bh=A7SoFSI1Th3nhlkgDnUeLfaMqyxXQzbJJ7s3bbT7Hvg=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=o/gAZZjg+j8O0GKmoU7BiBmls+RVtGx39/LxFs8pEekFui7XnG+jUD94m6wH0qhZl
 5udJiDCjLx1W1IZIqWGavVWQYBIZBq/vKE9Tvbudbu+DkgwlGZCvoAXGPnO84SszIW
 Zc3jI8Qf9E4vfKLFPoZslRtYiSscH9XRhEpS0aHYgxFgSehYHjmHiqJ7BV3+AVMjh8
 9eLX5EoxiFaYt2u9E3XrasiWEEOQrAjc0oITIBm1mMWV0RH5n7lfAeiLyYJtjP5bLJ
 XwchjxKL9sxty3ZxHLWry0K2JhjucUijaoMR0wMYoDXBR3LdoIEv687zfCx+WrHl17
 DKTXHRdmNacbQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4d8YHJ6M7Qz6tw2;
 Sun, 16 Nov 2025 15:32:12 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79787: 31.0.50; Unexpected point adjustment when passing
 over text that has 'invisible property and an overlay with 'display on top
In-Reply-To: <86a50mm4y1.fsf@HIDDEN>
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN> <87tsyui5g7.fsf@localhost>
 <86a50mm4y1.fsf@HIDDEN>
Date: Sun, 16 Nov 2025 14:32:13 +0000
Message-ID: <87346ehwve.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> So I don't think that case is relevant, but if you can come up with an
> example of any problems in the case of text properties, please show
> it.

What about the modified reproducer I provided?
You will still get the "jumpy" cursor behavior over the visible "!".

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 16 Nov 2025 14:24:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 09:24:03 2025
Received: from localhost ([127.0.0.1]:45120 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKdfe-0002KW-TX
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 09:24:03 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57382)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vKdfd-0002K0-Aj
 for 79787 <at> debbugs.gnu.org; Sun, 16 Nov 2025 09:24:02 -0500
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 <eliz@HIDDEN>)
 id 1vKdfW-0007MX-Fy; Sun, 16 Nov 2025 09:23:54 -0500
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=pqsI10jpmWNb+Fyw1Y8j+sHD3Li7RrFFNnzK+mmJfe4=; b=oLrR+TXzD38h
 9fE+97eBUyT3fq6qC0m2l7nVrSnkMlOGJl6FdoPs0NNNd6/yXFRXb4I3mfVddW97QHYnBvl/KLixc
 E8k4xOOOn6PYamBp0+WlssaUQ8vyZlMbn20nZ6stNH5/q85lZhjSCn59l6CK6QFbzhAebGbRLt7iS
 jIYAd3QuR470fyVw1YZ2tKvozrXnDyI1EUhoECY5iRXOJiVeakQ9muXzcI/MnIr0UXTr0193lEKKv
 sKGQk7jX6owzyez2DBJDbmjP96++AJswnRcew0VGgULcaDcydt7LRUmzVc30qhAGw1bdSIVW071WR
 Nca2htYUkfHJnlNTeBb7UQ==;
Date: Sun, 16 Nov 2025 16:23:50 +0200
Message-Id: <86a50mm4y1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87tsyui5g7.fsf@localhost> (message from Ihor Radchenko on Sun,
 16 Nov 2025 11:26:56 +0000)
Subject: Re: bug#79787: 31.0.50; Unexpected point adjustment when passing
 over text that has 'invisible property and an overlay with 'display on top
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN> <87tsyui5g7.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: monnier@HIDDEN, 79787 <at> debbugs.gnu.org
> Date: Sun, 16 Nov 2025 11:26:56 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Scratch that and use the improved patch below, which also fix3es the
> > original recipe.
> >
> > diff --git a/src/keyboard.c b/src/keyboard.c
> 
> Works for me. Both with my recipe and with the original bug report for
> Org mode.

Thanks, will install shortly.

> >  +	    !NILP (val = get_char_property_and_overlay
> >  +			   (make_fixnum (beg), Qdisplay, selected_window,
> >  +			    &overlay))
> >  +	    && display_prop_intangible_p (val, overlay, beg, CHAR_TO_BYTE (beg))
> >  +	    && OVERLAYP (overlay); # <<<<<<<<<<-------------
> 
> What if there is a display *text* property?

A display text property cannot "reveal" the invisible text as overlays
do.  The display engine examines the 'display' properties before
'invisible', and if it sees a 'display' property, 'invisible' on the
same or "enclosed" text is effectively ignored (not examined at all).
And if the invisible text encloses the one with 'display' property,
then the 'display' property is ignored.  So in this case, we will show
either the value of the 'display' property, and nothing for the
invisible text, or nothing at all.  This is unlike what happens with
overlays.

So I don't think that case is relevant, but if you can come up with an
example of any problems in the case of text properties, please show
it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 16 Nov 2025 11:27:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 16 06:27:06 2025
Received: from localhost ([127.0.0.1]:43730 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vKauP-0000zI-PG
	for submit <at> debbugs.gnu.org; Sun, 16 Nov 2025 06:27:06 -0500
Received: from mout01.posteo.de ([185.67.36.65]:46045)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>)
 id 1vKauO-0000yS-9V
 for 79787 <at> debbugs.gnu.org; Sun, 16 Nov 2025 06:27:04 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 25C6A240027
 for <79787 <at> debbugs.gnu.org>; Sun, 16 Nov 2025 12:26:56 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
 t=1763292417; bh=f2agJHli3relAm2RFqoVGqmCrhvKvBk2vmd0s7VM+vo=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type:
 From;
 b=VHG7S7A/ac+O6PJEC+yChCm8gp9cCxNqHMxQhNpFT+DHOixoSDZrslEct4roFwZDm
 rWBgt9uRQ/Es6OehoiIdKKicbODjNowVDaRbhuUm6pRtBfmNRxV3inAf/tFwERqnt5
 2q7KHsfN0aDlaGoklDzAQWTeaNtBsEevksh9S/UbaXEl9MGko1mMmyjM45+/1o0Jcf
 MEVFoi4BI7c+Sf4SPS7p8pdejjGT6MHo/sSC4Ya8klgFG8pWEFAwsZOMdJO8Rp+6Kb
 MCPH2IdrWsHUWt2t9hdTJVjqGwW5/oX5elO7BtSw9B2BM9FVFhkVg/q16z+4MOUkC2
 2GxccXf7i+s9g==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4d8T9X0dJgz9rxD;
 Sun, 16 Nov 2025 12:26:55 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#79787: 31.0.50; Unexpected point adjustment when passing
 over text that has 'invisible property and an overlay with 'display on top
In-Reply-To: <86wm3z49ig.fsf@HIDDEN>
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
 <86wm3z49ig.fsf@HIDDEN>
Date: Sun, 16 Nov 2025 11:26:56 +0000
Message-ID: <87tsyui5g7.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> Scratch that and use the improved patch below, which also fix3es the
> original recipe.
>
> diff --git a/src/keyboard.c b/src/keyboard.c

Works for me. Both with my recipe and with the original bug report for
Org mode.

>  +	    !NILP (val = get_char_property_and_overlay
>  +			   (make_fixnum (beg), Qdisplay, selected_window,
>  +			    &overlay))
>  +	    && display_prop_intangible_p (val, overlay, beg, CHAR_TO_BYTE (beg))
>  +	    && OVERLAYP (overlay); # <<<<<<<<<<-------------

What if there is a display *text* property?

(let (ovs)
   (with-current-buffer (generate-new-buffer "*temp*")
     (display-buffer-below-selected (current-buffer) nil)
     (insert "\n\n12345789")
     (goto-char (point-min))
     (with-silent-modifications
       (search-forward "1")
       (backward-char)
       (put-text-property (+ (point) 2) (+ (point) 4) 'invisible t)
       (read-char "Press any key (part of 123456789 hidden)")
       (dolist (offset '(0 1 2 3 4 5 6 7))
	 (put-text-property (+ offset (point)) (+ offset (point) 1) 'display (copy-sequence "!")))
       (message "NOW, move cursor across 123456789 string, observe point jumping across some !"))))

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 9 Nov 2025 13:32:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 09 08:32:22 2025
Received: from localhost ([127.0.0.1]:58849 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vI5Wn-00083o-IH
	for submit <at> debbugs.gnu.org; Sun, 09 Nov 2025 08:32:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:36718)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vI5Wk-00083N-UM
 for 79787 <at> debbugs.gnu.org; Sun, 09 Nov 2025 08:32:20 -0500
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 <eliz@HIDDEN>)
 id 1vI5We-0007SM-LN; Sun, 09 Nov 2025 08:32:12 -0500
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=0Uv38dv25ilAKFQU9ZMDV0QEaiWS3+9R+iCi8lymWgk=; b=d1cYawWtJAC9
 dCHKfGk9hY5Y5kaCwaG3S+sowU9Rf83k6M83Khkx45W6+adH/6Wg9b6BTJIPTfOKRp/b1X3xu5pSU
 hTFUFPGfEduNkOp5Jr3+zFEU4sJu3BoTBH6Xy0Oi5u26spgwniaaGmi6BKWCcbKBxH02WbPBQzULB
 ltAdB7ArUmZYO0Gen5pVG99fa2Hd0DyoMv7n7CKLKPmpFehDPaUeEPftvjhK6R2cbl78tN5KY+6gt
 oRzPbNBHCrb7KcKhBCbKEsG37V8yE24P1GfoFsx2qaJ+sF8znlyx7DCQ8CX5H/nrBerILsQBWHf+L
 pm/fOxhNesZoMEsndNck8w==;
Date: Sun, 09 Nov 2025 15:32:07 +0200
Message-Id: <86wm3z49ig.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: yantar92@HIDDEN, monnier@HIDDEN
In-Reply-To: <86zf8v4ihx.fsf@HIDDEN> (message from Eli Zaretskii on Sun, 09
 Nov 2025 12:18:02 +0200)
Subject: Re: bug#79787: 31.0.50;
 Unexpected point adjustment when passing over text that has
 'invisible property and an overlay with 'display on top
References: <87wm40954s.fsf@localhost> <86zf8v4ihx.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 79787 <at> debbugs.gnu.org
> Date: Sun, 09 Nov 2025 12:18:02 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Ihor Radchenko <yantar92@HIDDEN>
> > Date: Sat, 08 Nov 2025 10:43:37 +0000
> > 
> >  (let (ovs)
> >    (with-current-buffer (generate-new-buffer "*temp*")
> >      (display-buffer-below-selected (current-buffer) nil)
> >      (insert "\n\n12345789")
> >      (goto-char (point-min))
> >      (with-silent-modifications
> >        (search-forward "1")
> >        (backward-char)
> >        (put-text-property (+ (point) 2) (+ (point) 4) 'invisible t)
> >        (read-char "Press any key (part of 123456789 hidden)")
> >        (dolist (offset '(0 1 2 3 4 5 6 7 8))
> > 	 (push (make-overlay (+ offset (point)) (+ offset (point) 1)) ovs)
> > 	 (overlay-put (car ovs) 'display (copy-sequence "!")))
> >        (message "NOW, move cursor across 123456789 string, observe point jumping across some !"))))
> > 
> > When we put an overlay with 'display property on top of 'invisible text,
> > the overlay takes precedence and the text from 'display is visible on
> > place of the underlying text.
> > 
> > However, point adjustment does not seem to account for this scenario -
> > the point gets adjusted to bypass 'invisible text anyway, which is
> > unexpected as the point jumps over the visible overlay.
> > 
> > This issue has been originally reported in https://orgmode.org/list/87ms50z1bp.fsf@localhost
> 
> Point adjustment is not the only (nor the main) player here.  The
> other, more important player is the display-engine code which decides
> where to show the cursor when the text at point is not on display.
> 
> The patch at the end of this message improves the situation, I hope
> enough to close this issue.  It fixes the following simpler test case:
> 
>   ;; -*- lexical-binding: t -*-
>   (switch-to-buffer (get-buffer-create "foo"))
>   (erase-buffer)
>   (insert "\n\n1234567890")
>   (goto-char (point-min))
>   (search-forward "1")
>   (backward-char)
>   (put-text-property (+ (point) 2) (+ (point) 4) 'invisible t)
>   (overlay-put (make-overlay (+ (point) 2) (+ (point) 3)) 'display (copy-sequence "!!!"))
> 
> in that we now correctly jump the cursor when point moves across the
> display string "!!!".  The patch also (AFAIU) solves the original
> recipe from the bug reported to the Org list.  The test case that
> started the bug report, which sets 9 different adjacent
> display-property overlays, is improved, in that we only skip 1 "!",
> not more, but doesn't solve it completely.  However, given that these
> are display strings that we normally jump over anyway, I don't see the
> result as a problem, unless a real-life case exists where it does
> cause problems.

Scratch that and use the improved patch below, which also fix3es the
original recipe.

diff --git a/src/keyboard.c b/src/keyboard.c
index a9cbd10..ac69d8f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1726,7 +1726,7 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
      deleting characters around point.  */
   bool check_composition = ! modified;
   bool check_display = true, check_invisible = true;
-  ptrdiff_t orig_pt = PT;
+  ptrdiff_t orig_pt = PT, pt_before_invis = PT;
 
   eassert (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer);
 
@@ -1765,6 +1765,7 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
 	  check_composition = check_invisible = true;
 	}
       check_display = false;
+      pt_before_invis = PT;
       if (check_invisible && PT > BEGV && PT < ZV)
 	{
 	  int inv;
@@ -1841,10 +1842,28 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
 	 point-motion hooks, intangibility, etc.  */
 	  eassert (PT == beg || PT == end);
 #endif
-
 	  /* Pretend the area doesn't exist if the buffer is not
-	     modified.  */
-	  if (!modified && !ellipsis && beg < end)
+	     modified, but only if the invisible text is not shown on
+	     display.  If it _is_ shown, we don't need to move point,
+	     since the normal display of the cursor will DTRT.
+	     Invisible text might be "shown on display" if there's an
+	     overlay with a replacing display property on the same text:
+	     then whatever is specified by the display property will be
+	     shown instead of the invisible text.  */
+	  bool shown =
+	    !NILP (val = get_char_property_and_overlay
+			   (make_fixnum (beg), Qdisplay, selected_window,
+			    &overlay))
+	    && display_prop_intangible_p (val, overlay, beg, CHAR_TO_BYTE (beg))
+	    && OVERLAYP (overlay);
+
+	  /* If the "invisible" text is shown, undo any point
+             adjustments due to invisible property, as cursor
+             positioning will do the job better.  */
+	  if (shown)
+	    SET_PT (pt_before_invis);
+
+	  if (!modified && !shown && !ellipsis && beg < end)
 	    {
 	      if (last_pt == beg && PT == end && end < ZV)
 		(check_composition = check_display = true, SET_PT (end + 1));




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at 79787 <at> debbugs.gnu.org:


Received: (at 79787) by debbugs.gnu.org; 9 Nov 2025 10:18:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 09 05:18:15 2025
Received: from localhost ([127.0.0.1]:58047 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vI2Uw-0002vl-Ke
	for submit <at> debbugs.gnu.org; Sun, 09 Nov 2025 05:18:15 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:58456)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1vI2Ut-0002vW-Cp
 for 79787 <at> debbugs.gnu.org; Sun, 09 Nov 2025 05:18:12 -0500
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 <eliz@HIDDEN>)
 id 1vI2Un-0001kQ-8v; Sun, 09 Nov 2025 05:18:05 -0500
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=XZMe7/zzQML1BsEwllIG3uiqpAiUBPVBftQahDs7Rbo=; b=TXvw+Cmc6fLw
 jQa4Moxvcv1GZpndpW7EWr1lfFkYjvephMoCi1scY3pKClE/DZC6VLbWymxyD0yjUMd+Zk1F6Nkqp
 a6OfY0ljfzkPNSLuRV5k8qgEwpiIqx2h7WfTH7/hzTqD3gsRqSYSQ2T6BYj2oaEisVuYBl7GeTftr
 r6P9YOSQqOI5ydWpqP/F2HjWrqryaEDj+HpmDUPkkz1FX/UZ23lqqJK46jxoogEwkhPo+kP8HI/sA
 NUfCcGQRgzuvFOjQuBfhfhhb7OdKo5fPd7TpOtT4O5eFUM5euuv8KRMRvt6t4lb4YNL31s86nrsbY
 bM3DGCqaLn8JYyN9uV1FLw==;
Date: Sun, 09 Nov 2025 12:18:02 +0200
Message-Id: <86zf8v4ihx.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <87wm40954s.fsf@localhost> (message from Ihor Radchenko on Sat,
 08 Nov 2025 10:43:37 +0000)
Subject: Re: bug#79787: 31.0.50;
 Unexpected point adjustment when passing over text that has
 'invisible property and an overlay with 'display on top
References: <87wm40954s.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79787
Cc: 79787 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Date: Sat, 08 Nov 2025 10:43:37 +0000
> 
>  (let (ovs)
>    (with-current-buffer (generate-new-buffer "*temp*")
>      (display-buffer-below-selected (current-buffer) nil)
>      (insert "\n\n12345789")
>      (goto-char (point-min))
>      (with-silent-modifications
>        (search-forward "1")
>        (backward-char)
>        (put-text-property (+ (point) 2) (+ (point) 4) 'invisible t)
>        (read-char "Press any key (part of 123456789 hidden)")
>        (dolist (offset '(0 1 2 3 4 5 6 7 8))
> 	 (push (make-overlay (+ offset (point)) (+ offset (point) 1)) ovs)
> 	 (overlay-put (car ovs) 'display (copy-sequence "!")))
>        (message "NOW, move cursor across 123456789 string, observe point jumping across some !"))))
> 
> When we put an overlay with 'display property on top of 'invisible text,
> the overlay takes precedence and the text from 'display is visible on
> place of the underlying text.
> 
> However, point adjustment does not seem to account for this scenario -
> the point gets adjusted to bypass 'invisible text anyway, which is
> unexpected as the point jumps over the visible overlay.
> 
> This issue has been originally reported in https://orgmode.org/list/87ms50z1bp.fsf@localhost

Point adjustment is not the only (nor the main) player here.  The
other, more important player is the display-engine code which decides
where to show the cursor when the text at point is not on display.

The patch at the end of this message improves the situation, I hope
enough to close this issue.  It fixes the following simpler test case:

  ;; -*- lexical-binding: t -*-
  (switch-to-buffer (get-buffer-create "foo"))
  (erase-buffer)
  (insert "\n\n1234567890")
  (goto-char (point-min))
  (search-forward "1")
  (backward-char)
  (put-text-property (+ (point) 2) (+ (point) 4) 'invisible t)
  (overlay-put (make-overlay (+ (point) 2) (+ (point) 3)) 'display (copy-sequence "!!!"))

in that we now correctly jump the cursor when point moves across the
display string "!!!".  The patch also (AFAIU) solves the original
recipe from the bug reported to the Org list.  The test case that
started the bug report, which sets 9 different adjacent
display-property overlays, is improved, in that we only skip 1 "!",
not more, but doesn't solve it completely.  However, given that these
are display strings that we normally jump over anyway, I don't see the
result as a problem, unless a real-life case exists where it does
cause problems.

Please try the patch and tell if it causes any left-overs.

Stefan, any comments or better ideas?

diff --git a/src/keyboard.c b/src/keyboard.c
index a9cbd10..fe2484b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1841,10 +1841,22 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
 	 point-motion hooks, intangibility, etc.  */
 	  eassert (PT == beg || PT == end);
 #endif
-
 	  /* Pretend the area doesn't exist if the buffer is not
-	     modified.  */
-	  if (!modified && !ellipsis && beg < end)
+	     modified, but only if the invisible text is not shown on
+	     display.  If it _is_ shown, we don't need to move point,
+	     since the normal display of the cursor will DTRT.
+	     Invisible text might be "shown on display" if there's an
+	     overlay with a replacing display property on the same text:
+	     then whatever is specified by the display property will be
+	     shown instead of the invisible text.  */
+	  bool shown =
+	    !NILP (val = get_char_property_and_overlay
+			   (make_fixnum (beg), Qdisplay, selected_window,
+			    &overlay))
+	    && display_prop_intangible_p (val, overlay, beg, CHAR_TO_BYTE (beg))
+	    && OVERLAYP (overlay);
+
+	  if (!modified && !shown && !ellipsis && beg < end)
 	    {
 	      if (last_pt == beg && PT == end && end < ZV)
 		(check_composition = check_display = true, SET_PT (end + 1));




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 Nov 2025 10:43:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 08 05:43:56 2025
Received: from localhost ([127.0.0.1]:50934 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vHgQF-0007i4-L1
	for submit <at> debbugs.gnu.org; Sat, 08 Nov 2025 05:43:56 -0500
Received: from lists.gnu.org ([2001:470:142::17]:50642)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <yantar92@HIDDEN>)
 id 1vHgQC-0007hs-D1
 for submit <at> debbugs.gnu.org; Sat, 08 Nov 2025 05:43:53 -0500
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 <yantar92@HIDDEN>)
 id 1vHgQ3-0006U3-2F
 for bug-gnu-emacs@HIDDEN; Sat, 08 Nov 2025 05:43:43 -0500
Received: from mout02.posteo.de ([185.67.36.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1vHgQ0-0002ET-KB
 for bug-gnu-emacs@HIDDEN; Sat, 08 Nov 2025 05:43:42 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 1F63D240101
 for <bug-gnu-emacs@HIDDEN>; Sat,  8 Nov 2025 11:43:37 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posteo.net; s=2017;
 t=1762598618; bh=jJXwqWMCv6r5B4uNtbLrMx+fKTQ7yNKlRNASvkP3xJQ=;
 h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From;
 b=U88YA+eI+HvxAqSprNtx89MEc2xLTNVj0D4OPq5o/FZukiw1rN1yo7KT+QD8epncc
 wa5K4EVuiRU/unK/Pz2xbZ51SsDzEWfczm1gm8fRzAbclojXPgJljXjl4OoJQ2NLqC
 ImtLROEdmtXBKfr9WKRmvaj6Dmuc5RRexx/hjAEMZ3hNbII8kh9/Y8nddLHzdyKEdV
 u13Ud3woh1v+hb7HPMndbWZUsSJ5nWJqmYgMcnc3PbPC9t0lQK9OlYTZ+dMp60vryI
 TXjOQbga+01u8Id79WtqodhUFWNRXFBgU0dTlsrz8BOLhz+fHs9N/qLIYgnP46eAen
 aeZ4q34tW2s7A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4d3XbF4Dnmz9rxG
 for <bug-gnu-emacs@HIDDEN>; Sat,  8 Nov 2025 11:43:37 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; Unexpected point adjustment when passing over text that
 has 'invisible property and an overlay with 'display on top
X-Debbugs-Cc: 
Date: Sat, 08 Nov 2025 10:43:37 +0000
Message-ID: <87wm40954s.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@HIDDEN;
 helo=mout02.posteo.de
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

Hello,

Consider the following reproducer

 (let (ovs)
   (with-current-buffer (generate-new-buffer "*temp*")
     (display-buffer-below-selected (current-buffer) nil)
     (insert "\n\n12345789")
     (goto-char (point-min))
     (with-silent-modifications
       (search-forward "1")
       (backward-char)
       (put-text-property (+ (point) 2) (+ (point) 4) 'invisible t)
       (read-char "Press any key (part of 123456789 hidden)")
       (dolist (offset '(0 1 2 3 4 5 6 7 8))
	 (push (make-overlay (+ offset (point)) (+ offset (point) 1)) ovs)
	 (overlay-put (car ovs) 'display (copy-sequence "!")))
       (message "NOW, move cursor across 123456789 string, observe point jumping across some !"))))

When we put an overlay with 'display property on top of 'invisible text,
the overlay takes precedence and the text from 'display is visible on
place of the underlying text.

However, point adjustment does not seem to account for this scenario -
the point gets adjusted to bypass 'invisible text anyway, which is
unexpected as the point jumps over the visible overlay.

This issue has been originally reported in https://orgmode.org/list/87ms50z1bp.fsf@localhost


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
 1.18.4) of 2025-04-28 built on localhost
Repository revision: 509cbe1c35b3dd005a53ac041f9c87ee53b8e115
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101018
System Description: Gentoo Linux

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Acknowledgement sent to Ihor Radchenko <yantar92@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#79787; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 16 Nov 2025 15:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.