Only execute the replace command when the user input valid query
This commit is contained in:
parent
aa14f6c620
commit
f01ffea021
|
@ -1199,13 +1199,15 @@ CUSTOM_DOC("Queries the user for a needle and string. Replaces all occurences of
|
|||
Scratch_Block scratch(app);
|
||||
Query_Bar_Group group(app);
|
||||
String_Pair pair = query_user_replace_pair(app, scratch);
|
||||
if (pair.valid)
|
||||
{
|
||||
for (Buffer_ID buffer = get_buffer_next(app, 0, Access_ReadWriteVisible);
|
||||
buffer != 0;
|
||||
buffer = get_buffer_next(app, buffer, Access_ReadWriteVisible)){
|
||||
Range_i64 range = buffer_range(app, buffer);
|
||||
replace_in_range(app, buffer, range, pair.a, pair.b);
|
||||
}
|
||||
|
||||
}
|
||||
global_history_edit_group_end(app);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue