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:
Open a buffer with the following content:
String to be replaced. Another string.
String to be replaced. Another string.
End
Run the following command:
(query-replace "String to be replaced." "Replacement." nil (point-min) (point-max))
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
Visual Evidence:
act-and-show
(match):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