feat(tasks): mark task buffers as clean when task exits
This commit is contained in:
parent
a28f1db4c7
commit
304a62dfdc
3 changed files with 18 additions and 2 deletions
|
@ -1317,6 +1317,10 @@ pub fn store_to_file_and_clean(self: *Self, file_path: []const u8) StoreToFileEr
|
|||
self.file_utf8_sanitized = false;
|
||||
}
|
||||
|
||||
pub fn mark_clean(self: *Self) void {
|
||||
self.last_save = self.root;
|
||||
}
|
||||
|
||||
pub fn is_dirty(self: *const Self) bool {
|
||||
return if (!self.file_exists)
|
||||
self.root.length() > 0
|
||||
|
|
|
@ -4724,6 +4724,14 @@ pub const Editor = struct {
|
|||
}
|
||||
pub const switch_case_meta = .{ .description = "Switch the case of selection or character at cursor" };
|
||||
|
||||
pub fn forced_mark_clean(self: *Self, _: Context) Result {
|
||||
if (self.buffer) |b| {
|
||||
b.mark_clean();
|
||||
self.update_event() catch {};
|
||||
}
|
||||
}
|
||||
pub const forced_mark_clean_meta = .{ .description = "Force current file to be marked as clean" };
|
||||
|
||||
pub fn toggle_eol_mode(self: *Self, _: Context) Result {
|
||||
if (self.buffer) |b| {
|
||||
b.file_eol_mode = switch (b.file_eol_mode) {
|
||||
|
|
|
@ -759,8 +759,12 @@ const cmds = struct {
|
|||
var buffer_ref: usize = 0;
|
||||
if (!try ctx.args.match(.{tp.extract(&buffer_ref)}))
|
||||
return error.InvalidShellOutputCompleteArgument;
|
||||
// TODO
|
||||
_ = self;
|
||||
const buffer = self.buffer_manager.buffer_from_ref(buffer_ref) orelse return;
|
||||
if (self.get_active_editor()) |editor| if (editor.buffer) |eb| if (eb == buffer) {
|
||||
editor.forced_mark_clean(.{}) catch {};
|
||||
return;
|
||||
};
|
||||
buffer.mark_clean();
|
||||
}
|
||||
pub const shell_execute_stream_output_complete_meta = .{ .arguments = &.{ .integer, .string } };
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue