diff --git a/src/tui/status/branch.zig b/src/tui/status/branch.zig index 7f6dfc4..9e4ff44 100644 --- a/src/tui/status/branch.zig +++ b/src/tui/status/branch.zig @@ -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)