refactor: notify editors on vcs_content updates
This commit is contained in:
parent
3fb4bd6510
commit
4d1eaa767b
2 changed files with 6 additions and 0 deletions
|
|
@ -1857,6 +1857,10 @@ pub const Editor = struct {
|
||||||
tp.self_pid().send(.{ "cmd", "save_file", .{} }) catch {};
|
tp.self_pid().send(.{ "cmd", "save_file", .{} }) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn vcs_content_update(self: *const Self) !void {
|
||||||
|
_ = try self.handlers.msg(.{ "E", "update" });
|
||||||
|
}
|
||||||
|
|
||||||
fn send_editor_eol_mode(self: *const Self, eol_mode: Buffer.EolMode, utf8_sanitized: bool, indent_mode: IndentMode) !void {
|
fn send_editor_eol_mode(self: *const Self, eol_mode: Buffer.EolMode, utf8_sanitized: bool, indent_mode: IndentMode) !void {
|
||||||
_ = try self.handlers.msg(.{ "E", "eol_mode", eol_mode, utf8_sanitized, indent_mode });
|
_ = try self.handlers.msg(.{ "E", "eol_mode", eol_mode, utf8_sanitized, indent_mode });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1976,5 +1976,7 @@ pub fn vcs_content_update(self: *Self, m: tp.message) void {
|
||||||
if (m.match(.{ "PRJ", "vcs_content", tp.extract(&file_path), tp.extract(&vcs_id), tp.extract(&content) }) catch return) {
|
if (m.match(.{ "PRJ", "vcs_content", tp.extract(&file_path), tp.extract(&vcs_id), tp.extract(&content) }) catch return) {
|
||||||
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
|
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
|
||||||
buffer.set_vcs_content(vcs_id, content) catch {};
|
buffer.set_vcs_content(vcs_id, content) catch {};
|
||||||
|
if (self.get_editor_for_buffer(buffer)) |editor|
|
||||||
|
editor.vcs_content_update() catch {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue