feat: add enable_auto_save configuration option

This commit is contained in:
CJ van den Berg 2025-07-16 16:35:03 +02:00
parent 7bdbe60776
commit c300c4f7f2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 4 additions and 0 deletions

View file

@ -21,6 +21,8 @@ enable_format_on_save: bool = false,
restore_last_cursor_position: bool = true, restore_last_cursor_position: bool = true,
follow_cursor_on_buffer_switch: bool = false, //scroll cursor into view on buffer switch follow_cursor_on_buffer_switch: bool = false, //scroll cursor into view on buffer switch
default_cursor: []const u8 = "default", default_cursor: []const u8 = "default",
enable_auto_save: bool = false,
auto_save_file_types: []const []const u8 = &.{},
indent_size: usize = 4, indent_size: usize = 4,
tab_width: usize = 8, tab_width: usize = 8,

View file

@ -350,6 +350,7 @@ pub const Editor = struct {
completions: std.ArrayListUnmanaged(u8) = .empty, completions: std.ArrayListUnmanaged(u8) = .empty,
enable_auto_save: bool,
enable_format_on_save: bool, enable_format_on_save: bool,
need_save_after_filter: ?struct { need_save_after_filter: ?struct {
@ -462,6 +463,7 @@ pub const Editor = struct {
.animation_lag = get_animation_max_lag(), .animation_lag = get_animation_max_lag(),
.animation_frame_rate = frame_rate, .animation_frame_rate = frame_rate,
.animation_last_time = time.microTimestamp(), .animation_last_time = time.microTimestamp(),
.enable_auto_save = tui.config().enable_auto_save,
.enable_format_on_save = tui.config().enable_format_on_save, .enable_format_on_save = tui.config().enable_format_on_save,
.enable_terminal_cursor = tui.config().enable_terminal_cursor, .enable_terminal_cursor = tui.config().enable_terminal_cursor,
.render_whitespace = from_whitespace_mode(tui.config().whitespace_mode), .render_whitespace = from_whitespace_mode(tui.config().whitespace_mode),