feat: refresh branch status on file state change events
This commit is contained in:
parent
bfa851e886
commit
6f82b4aaf3
1 changed files with 11 additions and 0 deletions
|
@ -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 {
|
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" }))
|
if (try m.match(.{ "PRJ", "open" }))
|
||||||
self.refresh_git_status();
|
self.refresh_git_status();
|
||||||
return false;
|
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 {
|
fn receive_git(self: *Self, _: tp.pid_ref, m: tp.message) MessageFilter.Error!bool {
|
||||||
return if (try match(m.buf, .{ "git", more }))
|
return if (try match(m.buf, .{ "git", more }))
|
||||||
self.process_git(m)
|
self.process_git(m)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue