Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sidebarApps/searchInFiles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ async function replaceAll() {
const search = $search.value;
const replace = $replace.value;
const options = getOptions();
if (!search || !replace) return;
if (!search) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Empty files keep old text

Empty replacement still fails when it removes all text from a file that is not already open. Both replacement paths pass text: "" to openFile, but its unopened-file branch uses if (text) and reloads the original content instead. For example, replacing foo with an empty string in an unopened file containing only foo leaves it unchanged and marked as saved.

Update openFile to distinguish empty text from missing text, and add a regression test for this case.

Knowledge Base Used: Workspace file sessions

const regex = toRegex(search, options);
if (!regex) return;

Expand Down
Loading