unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71430: Persistent Highlighting Issue with query-replace using "act-and-show" Option
@ 2024-06-08  7:29 Gabriele Nicolardi
  2024-06-08  8:33 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriele Nicolardi @ 2024-06-08  7:29 UTC (permalink / raw)
  To: 71430


[-- Attachment #1.1: Type: text/plain, Size: 1557 bytes --]

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

​

[-- Attachment #1.2.1: Type: text/html, Size: 146549 bytes --]

[-- Attachment #1.2.2: MWE_130.png --]
[-- Type: image/png, Size: 38561 bytes --]

[-- Attachment #1.2.3: MWE_131.png --]
[-- Type: image/png, Size: 37614 bytes --]

[-- Attachment #2: match.png --]
[-- Type: image/png, Size: 38561 bytes --]

[-- Attachment #3: replacement.png --]
[-- Type: image/png, Size: 37614 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-08 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-08  7:29 bug#71430: Persistent Highlighting Issue with query-replace using "act-and-show" Option Gabriele Nicolardi
2024-06-08  8:33 ` Eli Zaretskii
2024-06-08 10:41   ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).