fix: prevent whole file filter commands from erasing the entire file
This commit is contained in:
parent
693ed91b12
commit
0974935ced
1 changed files with 4 additions and 0 deletions
|
|
@ -6281,6 +6281,10 @@ pub const Editor = struct {
|
||||||
self.cancel_all_selections();
|
self.cancel_all_selections();
|
||||||
self.cancel_all_matches();
|
self.cancel_all_matches();
|
||||||
if (state.whole_file) |buf| {
|
if (state.whole_file) |buf| {
|
||||||
|
if (buf.items.len == 0) {
|
||||||
|
self.logger.print_err("filter", "empty filter result", .{});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const old_hash = blk: {
|
const old_hash = blk: {
|
||||||
var content: std.Io.Writer.Allocating = .init(self.allocator);
|
var content: std.Io.Writer.Allocating = .init(self.allocator);
|
||||||
defer content.deinit();
|
defer content.deinit();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue