Merge branch 'master' into zig-0.14

This commit is contained in:
CJ van den Berg 2025-02-11 13:32:11 +01:00
commit 0cd48c5eaa
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
6 changed files with 97 additions and 36 deletions

View file

@ -50,6 +50,10 @@ curr_history: ?*UndoNode = null,
mtime: i64,
utime: i64,
file_type_name: ?[]const u8 = null,
file_type_icon: ?[]const u8 = null,
file_type_color: ?u24 = null,
pub const EolMode = enum { lf, crlf };
pub const EolModeTag = @typeInfo(EolMode).@"enum".tag_type;
@ -58,6 +62,7 @@ const UndoNode = struct {
next: ?*UndoNode = null,
branches: ?*UndoBranch = null,
meta: []const u8,
file_eol_mode: EolMode,
};
const UndoBranch = struct {
@ -1247,6 +1252,7 @@ pub fn reset_to_last_saved(self: *Self) void {
if (self.last_save) |last_save| {
self.store_undo(&[_]u8{}) catch {};
self.root = last_save;
self.file_eol_mode = self.last_save_eol_mode;
self.mtime = std.time.milliTimestamp();
}
}
@ -1385,6 +1391,7 @@ fn create_undo(self: *const Self, root: Root, meta_: []const u8) error{OutOfMemo
h.* = UndoNode{
.root = root,
.meta = meta,
.file_eol_mode = self.file_eol_mode,
};
return h;
}
@ -1420,6 +1427,7 @@ pub fn undo(self: *Self, meta: []const u8) error{Stop}![]const u8 {
self.undo_history = h.next;
self.curr_history = h;
self.root = h.root;
self.file_eol_mode = h.file_eol_mode;
self.push_redo(r);
self.mtime = std.time.milliTimestamp();
return h.meta;
@ -1432,6 +1440,7 @@ pub fn redo(self: *Self) error{Stop}![]const u8 {
self.redo_history = h.next;
self.curr_history = h;
self.root = h.root;
self.file_eol_mode = h.file_eol_mode;
self.push_undo(u);
self.mtime = std.time.milliTimestamp();
return h.meta;