GNU bug report logs - #71430
Persistent Highlighting Issue with query-replace using "act-and-show" Option

Previous Next

Package: emacs;

Reported by: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>

Date: Sat, 8 Jun 2024 07:31:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 71430 in the body.
You can then email your comments to 71430 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#71430; Package emacs. (Sat, 08 Jun 2024 07:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gabriele Nicolardi <gabriele <at> medialab.sissa.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 08 Jun 2024 07:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Persistent Highlighting Issue with query-replace using "act-and-show"
 Option
Date: Sat, 8 Jun 2024 09:29:41 +0200
[Message part 1 (text/plain, inline)]
Hi,
I’ve encountered a potential bug in Emacs when using the |query-replace| 
(via |perform-replace|) functions. When performing text replacements 
across a buffer and choosing to replace but not immediately move the 
point (using the |,| |act-and-show| option), the function does replace 
the text as expected but fails to update the highlighting to the region 
containing the replacement.

*Steps to Reproduce:*

1.

   Open a buffer with the following content:

   |String to be replaced. Another string. String to be replaced.
   Another string. End |

2.

   Run the following command:

   |(query-replace "String to be replaced." "Replacement." nil
   (point-min) (point-max)) |

3.

   When prompted to replace a match, use the |,| (|act-and-show|)
   option to replace the text but pause moving to the next match.

*Expected Behavior:*
After a replacement is made and before moving to the next match, the 
highlighted region of the replaced text should be “updated” to fit the 
replaced text.

*Actual Behavior:*
The highlighting remains on the matched region. This issue can be 
visually confirmed in the following animation:
View Animation on Imgur <https://imgur.com/a/BxVwVff>

*Visual Evidence:*

 * Highlight *before* using |act-and-show| (match):

 * Highlight *after* using |act-and-show| while paused (replacement):

As demonstrated, the highlighted region post-replacement does not 
correspond to any current match, which is misleading and might affect 
further editing decisions.

Best regards,

Gabriele Nicolardi

​
[Message part 2 (text/html, inline)]
[MWE_130.png (image/png, inline)]
[MWE_131.png (image/png, inline)]
[match.png (image/png, attachment)]
[replacement.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#71430; Package emacs. (Sat, 08 Jun 2024 09:11:03 GMT) Full text and rfc822 format available.

Message #8 received at 71430 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 71430 <at> debbugs.gnu.org
Subject: Re: bug#71430: Persistent Highlighting Issue with query-replace using
 "act-and-show" Option
Date: Sat, 08 Jun 2024 11:33:55 +0300
> Date: Sat, 8 Jun 2024 09:29:41 +0200
> From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
> 
> I’ve encountered a potential bug in Emacs when using the |query-replace| 
> (via |perform-replace|) functions. When performing text replacements 
> across a buffer and choosing to replace but not immediately move the 
> point (using the |,| |act-and-show| option), the function does replace 
> the text as expected but fails to update the highlighting to the region 
> containing the replacement.
> 
> *Steps to Reproduce:*
> 
>  1.
> 
>     Open a buffer with the following content:
> 
>     |String to be replaced. Another string. String to be replaced.
>     Another string. End |
> 
>  2.
> 
>     Run the following command:
> 
>     |(query-replace "String to be replaced." "Replacement." nil
>     (point-min) (point-max)) |
> 
>  3.
> 
>     When prompted to replace a match, use the |,| (|act-and-show|)
>     option to replace the text but pause moving to the next match.
> 
> *Expected Behavior:*
> After a replacement is made and before moving to the next match, the 
> highlighted region of the replaced text should be “updated” to fit the 
> replaced text.
> 
> *Actual Behavior:*
> The highlighting remains on the matched region. This issue can be 
> visually confirmed in the following animation:

You don't say in what version of Emacs you see the problematic
behavior.  I can reproduce the behavior you report in Emacs 29, but
not in Emacs 30 (on the master branch of the Emacs Git repository).
So I think this bug was already solved on the master branch, which
will become Emacs 30.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 08 Jun 2024 10:44:02 GMT) Full text and rfc822 format available.

Notification sent to Gabriele Nicolardi <gabriele <at> medialab.sissa.it>:
bug acknowledged by developer. (Sat, 08 Jun 2024 10:44:02 GMT) Full text and rfc822 format available.

Message #13 received at 71430-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: gabriele <at> medialab.sissa.it
Cc: 71430-done <at> debbugs.gnu.org
Subject: Re: bug#71430: Persistent Highlighting Issue with query-replace using
 "act-and-show" Option
Date: Sat, 08 Jun 2024 13:41:02 +0300
> Date: Sat, 8 Jun 2024 11:05:24 +0200
> From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
> 
> Il 08/06/24 10:33, Eli Zaretskii ha scritto:
> >> Date: Sat, 8 Jun 2024 09:29:41 +0200
> >> From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
> >>
> >> I’ve encountered a potential bug in Emacs when using the |query-replace|
> >> (via |perform-replace|) functions. When performing text replacements
> >> across a buffer and choosing to replace but not immediately move the
> >> point (using the |,| |act-and-show| option), the function does replace
> >> the text as expected but fails to update the highlighting to the region
> >> containing the replacement.
> >>
> >> *Steps to Reproduce:*
> >>
> >>   1.
> >>
> >>      Open a buffer with the following content:
> >>
> >>      |String to be replaced. Another string. String to be replaced.
> >>      Another string. End |
> >>
> >>   2.
> >>
> >>      Run the following command:
> >>
> >>      |(query-replace "String to be replaced." "Replacement." nil
> >>      (point-min) (point-max)) |
> >>
> >>   3.
> >>
> >>      When prompted to replace a match, use the |,| (|act-and-show|)
> >>      option to replace the text but pause moving to the next match.
> >>
> >> *Expected Behavior:*
> >> After a replacement is made and before moving to the next match, the
> >> highlighted region of the replaced text should be “updated” to fit the
> >> replaced text.
> >>
> >> *Actual Behavior:*
> >> The highlighting remains on the matched region. This issue can be
> >> visually confirmed in the following animation:
> > You don't say in what version of Emacs you see the problematic
> > behavior.  I can reproduce the behavior you report in Emacs 29, but
> > not in Emacs 30 (on the master branch of the Emacs Git repository).
> > So I think this bug was already solved on the master branch, which
> > will become Emacs 30.
> 
> 
> 
> > > Cc: 71430 <at> debbugs.gnu.org
> > > Date: Sat, 08 Jun 2024 11:33:55 +0300
> > > From: Eli Zaretskii <eliz <at> gnu.org>
> > > 
> > > > Date: Sat, 8 Jun 2024 09:29:41 +0200
> > > > From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
> > > > 
> > > > I’ve encountered a potential bug in Emacs when using the |query-replace| 
> > > > (via |perform-replace|) functions. When performing text replacements 
> > > > across a buffer and choosing to replace but not immediately move the 
> > > > point (using the |,| |act-and-show| option), the function does replace 
> > > > the text as expected but fails to update the highlighting to the region 
> > > > containing the replacement.
> > > > 
> > > > *Steps to Reproduce:*
> > > > 
> > > >  1.
> > > > 
> > > >     Open a buffer with the following content:
> > > > 
> > > >     |String to be replaced. Another string. String to be replaced.
> > > >     Another string. End |
> > > > 
> > > >  2.
> > > > 
> > > >     Run the following command:
> > > > 
> > > >     |(query-replace "String to be replaced." "Replacement." nil
> > > >     (point-min) (point-max)) |
> > > > 
> > > >  3.
> > > > 
> > > >     When prompted to replace a match, use the |,| (|act-and-show|)
> > > >     option to replace the text but pause moving to the next match.
> > > > 
> > > > *Expected Behavior:*
> > > > After a replacement is made and before moving to the next match, the 
> > > > highlighted region of the replaced text should be “updated” to fit the 
> > > > replaced text.
> > > > 
> > > > *Actual Behavior:*
> > > > The highlighting remains on the matched region. This issue can be 
> > > > visually confirmed in the following animation:
> > > 
> > > You don't say in what version of Emacs you see the problematic
> > > behavior.  I can reproduce the behavior you report in Emacs 29, but
> > > not in Emacs 30 (on the master branch of the Emacs Git repository).
> > > So I think this bug was already solved on the master branch, which
> > > will become Emacs 30.
> 
> Oh, sorry! My Emacs version is 29.3.

OK, thanks, so I'm now closing this bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 06 Jul 2024 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 44 days ago.

Previous Next


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