Closed
Description
I tried to do some basic find-and-replace to my text file as follow:
- Bring up the find-and-replace feature (
Ctrl-R
orMenu
->Edit
->Replace
) - Type the
Find:
field. - Leave the
Replace:
field (so I want to nuke all occurrences). - There is no way to do replacement unless the replacement field is not empty. If it is not empty, replacement can be done by pressing
Enter
repeatedly. If it is empty, pressingEnter
simply moves to the next occurrence without replacing. - Clicking
[Replace All]
does nothing.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Shivix commentedon Jun 8, 2025
Write is explicitly checking if the text to write is empty:
edit/src/buffer/mod.rs
Line 1818 in 5c5471e
When removing this check, replacing with an empty string seems to works fine. We could check if text is empty outside of the function in places where write is used besides find and replace. This is already done here:
edit/src/tui.rs
Line 2696 in 5c5471e
That said, we could instead utilise
extract_selection(true)
here instead. It's more explicit and I expect it'll be more performant.Fix Find & Replace with empty replacements (#457)