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;
|
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 {
|
pub fn is_dirty(self: *const Self) bool {
|
||||||
return if (!self.file_exists)
|
return if (!self.file_exists)
|
||||||
self.root.length() > 0
|
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 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 {
|
pub fn toggle_eol_mode(self: *Self, _: Context) Result {
|
||||||
if (self.buffer) |b| {
|
if (self.buffer) |b| {
|
||||||
b.file_eol_mode = switch (b.file_eol_mode) {
|
b.file_eol_mode = switch (b.file_eol_mode) {
|
||||||
|
|
|
@ -759,8 +759,12 @@ const cmds = struct {
|
||||||
var buffer_ref: usize = 0;
|
var buffer_ref: usize = 0;
|
||||||
if (!try ctx.args.match(.{tp.extract(&buffer_ref)}))
|
if (!try ctx.args.match(.{tp.extract(&buffer_ref)}))
|
||||||
return error.InvalidShellOutputCompleteArgument;
|
return error.InvalidShellOutputCompleteArgument;
|
||||||
// TODO
|
const buffer = self.buffer_manager.buffer_from_ref(buffer_ref) orelse return;
|
||||||
_ = self;
|
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 } };
|
pub const shell_execute_stream_output_complete_meta = .{ .arguments = &.{ .integer, .string } };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue