unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
To: 71430@debbugs.gnu.org
Subject: bug#71430: Persistent Highlighting Issue with query-replace using "act-and-show" Option
Date: Sat, 8 Jun 2024 09:29:41 +0200	[thread overview]
Message-ID: <43f6ae01-d581-4b88-8914-da9943178c92@medialab.sissa.it> (raw)


[-- 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 --]

             reply	other threads:[~2024-06-08  7:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-08  7:29 Gabriele Nicolardi [this message]
2024-06-08  8:33 ` bug#71430: Persistent Highlighting Issue with query-replace using "act-and-show" Option Eli Zaretskii
2024-06-08 10:41   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43f6ae01-d581-4b88-8914-da9943178c92@medialab.sissa.it \
    --to=gabriele@medialab.sissa.it \
    --cc=71430@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).