From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Graner Newsgroups: gmane.emacs.bugs Subject: bug#58937: text-property-search-backward misses one-character regions Date: Tue, 01 Nov 2022 00:20:58 +0100 Message-ID: <874jvjh95x.fsf@graner.name> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39407"; mail-complaints-to="usenet@ciao.gmane.io" To: 58937@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 01 00:22:20 2022 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 1ope6i-0009oH-K2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 01 Nov 2022 00:22:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ope6X-0007UK-8s; Mon, 31 Oct 2022 19:22: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 1ope6V-0007U1-9d for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 19:22: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 1ope6U-0005B0-RU for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 19:22:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ope6U-0005n4-Hu for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 19:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Graner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2022 23:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58937 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166725847122194 (code B ref -1); Mon, 31 Oct 2022 23:22:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Oct 2022 23:21:11 +0000 Original-Received: from localhost ([127.0.0.1]:42242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ope5f-0005lu-CV for submit@debbugs.gnu.org; Mon, 31 Oct 2022 19:21:11 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ope5d-0005lm-BC for submit@debbugs.gnu.org; Mon, 31 Oct 2022 19:21:10 -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 1ope5d-00070u-6L for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 19:21:09 -0400 Original-Received: from ouvsmtp1.octopuce.fr ([194.36.166.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ope5b-0004rz-DN for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 19:21:08 -0400 Original-Received: from panel.vitry.ouvaton.coop (unknown [194.36.166.20]) by ouvsmtp1.octopuce.fr (Postfix) with ESMTPS id 29F3B126 for ; Tue, 1 Nov 2022 00:20:59 +0100 (CET) Original-Received: from hypra-graner (215.124.67.86.rev.sfr.net [86.67.124.215]) by panel.vitry.ouvaton.coop (Postfix) with ESMTPSA id C64965E2090 for ; Tue, 1 Nov 2022 00:20:58 +0100 (CET) Received-SPF: pass client-ip=194.36.166.50; envelope-from=nicolas@graner.name; helo=ouvsmtp1.octopuce.fr X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246731 Archived-At: In Emacs 29.0.50, when a single character has a text property and you try to find it with text-property-search-backward, the result incorrectly includes previous characters without the property. Example: (with-current-buffer (generate-new-buffer "test") (insert "123456789") (put-text-property 3 4 'foo 'bar) (goto-char 6) (text-property-search-backward 'foo)) The returned value is #s(prop-match 1 4 nil) instead of #s(prop-match 3 4 bar) and the point in the test buffer is moved to position 1 instead of 3. This incorrect behavior is the same if you replace (goto-char 6) with (goto-char 5) or any other value greater than 4. However, the result is correct with (goto-char 4), i.e. when the backward search starts one position after the target character. This suggests an off-by-one error in the code. Hope this helps, Nicolas