#3447·fresh

Project Search/Replace (Alt+A): $1 written literally, hidden files not searched, and UI problems

Author: sinelawCreated Sep 29, 2026Updated Sep 30, 2026

Problems found in the project-wide Search/Replace panel (Alt+A) while reproducing a report. All reproduced interactively in tmux on master (f3fcb53). The in-file replace (Ctrl+R) does not have problem 1.

1. Regex replace writes $1 literally

In a file containing test rest lest: Alt+A, Alt+R (Regex on), search (.)est, replace $1ent, Replace All.

  • Expected: tent rent lent (this is what Ctrl+R produces)
  • Actual: $1ent $1ent $1ent

The plugin sends only match offsets and the replacement text to replaceInFile, and the host writes the same string over every match, so capture groups are never expanded.

2. Hidden files are never searched, even when open

Open .fresh-tour.json, run "Search and Replace in Current File", turn Regex on and search step([_a-z]*) → "No matches found", although the file has several step_id lines. With All Files on, an open .hidden.txt is skipped as well while visible.txt with the same text is found.

The project walk uses include_hidden: false, and current-file scope only filters the walk's results, so a dotfile (or a file under a skipped directory) can't match. Relatedly, current-file mode runs the whole-project search and filters it afterwards, so the 10,000-result cap can cut off the current file's matches in a large project.

3. "Replace All in " button is cut off

With the scope set to one file, [ Replace All in .fresh-tour.json (Alt+Ret) ] is squeezed onto the toggle row, touching Whole(Alt+W) and truncated (…).

4. The Replace confirmation is easy to miss

Replace All asks on the prompt line at the bottom of the screen, which is hard to notice. It should be a modal dialog.

5. Undoing a replace doesn't bring the matches back in the panel

After Replace All, focus the edited file and press Ctrl+Z: every replacement is undone in one step, but the panel still reads "No matches found" until the search is re-run by hand. The replace's undo is a single bulk edit, and bulk edits (like multi-cursor typing and its undo) fire no after_insert / after_delete, so no plugin is told the buffer changed.

6. Regex toggle state is surprising (not fixed yet)

The Case/Regex/Whole toggles are remembered for the session. Reopening the panel with Regex already on and pressing Alt+R (as on first use) turns it off; (.)est then finds nothing and Replace All reports "No items selected". This matches the report's "it stopped replacing altogether". The state could be made more visible, or the empty-results message could mention that Regex is off.


PR #3446 fixes 1–5. Problem 6 is still open.