fix: avoid spamming the differ on every vcs_content frame

This commit is contained in:
CJ van den Berg 2025-12-17 22:32:57 +01:00
parent 1190c99212
commit 3c9cf07f9d
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 3 additions and 0 deletions

View file

@ -2605,5 +2605,6 @@ pub fn process_git_response(self: *Self, parent: tp.pid_ref, m: tp.message) (Out
} else if (try m.match(.{ tp.any, tp.extract(&context), "cat_file", tp.null_ })) { } else if (try m.match(.{ tp.any, tp.extract(&context), "cat_file", tp.null_ })) {
const request: *VcsContentRequest = @ptrFromInt(context); const request: *VcsContentRequest = @ptrFromInt(context);
defer request.deinit(); defer request.deinit();
parent.send(.{ "PRJ", "vcs_content", request.file_path, request.vcs_id, null }) catch {};
} }
} }

View file

@ -1976,6 +1976,8 @@ 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 {};
} else if (m.match(.{ "PRJ", "vcs_content", tp.extract(&file_path), tp.extract(&vcs_id), tp.null_ }) catch return) {
const buffer = self.buffer_manager.get_buffer_for_file(file_path) orelse return;
if (self.get_editor_for_buffer(buffer)) |editor| if (self.get_editor_for_buffer(buffer)) |editor|
editor.vcs_content_update() catch {}; editor.vcs_content_update() catch {};
} }