feat: refresh branch status on file state change events

This commit is contained in:
CJ van den Berg 2025-07-29 10:29:06 +02:00
parent bfa851e886
commit 6f82b4aaf3
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -71,11 +71,22 @@ fn refresh_git_status(_: *Self) void {
}
pub fn receive(self: *Self, _: *Button.State(Self), _: tp.pid_ref, m: tp.message) error{Exit}!bool {
if (try m.match(.{ "E", tp.more }))
return self.process_event(m);
if (try m.match(.{ "PRJ", "open" }))
self.refresh_git_status();
return false;
}
fn process_event(self: *Self, m: tp.message) error{Exit}!bool {
if (try m.match(.{ tp.any, "dirty", tp.more }) or
try m.match(.{ tp.any, "save", tp.more }) or
try m.match(.{ tp.any, "open", tp.more }) or
try m.match(.{ tp.any, "close" }))
self.refresh_git_status();
return false;
}
fn receive_git(self: *Self, _: tp.pid_ref, m: tp.message) MessageFilter.Error!bool {
return if (try match(m.buf, .{ "git", more }))
self.process_git(m)