refactor(terminal): close terminal on escape keypress if exited
This commit is contained in:
parent
57aae0d45c
commit
0a37c2b05b
1 changed files with 12 additions and 6 deletions
|
|
@ -155,12 +155,18 @@ pub fn receive(self: *Self, from: tp.pid_ref, m: tp.message) error{Exit}!bool {
|
|||
.mods = @bitCast(modifiers),
|
||||
.text = if (text.len > 0) text else null,
|
||||
};
|
||||
if (self.vt.process_exited and (keypress == input.key.enter or keypress == '\r')) {
|
||||
self.vt.process_exited = false;
|
||||
self.restart() catch |e|
|
||||
std.log.err("terminal_view: restart failed: {}", .{e});
|
||||
tui.need_render(@src());
|
||||
return true;
|
||||
if (self.vt.process_exited) {
|
||||
if (keypress == input.key.enter) {
|
||||
self.vt.process_exited = false;
|
||||
self.restart() catch |e|
|
||||
std.log.err("terminal_view: restart failed: {}", .{e});
|
||||
tui.need_render(@src());
|
||||
return true;
|
||||
}
|
||||
if (keypress == input.key.escape) {
|
||||
tp.self_pid().send(.{ "cmd", "close_terminal", .{} }) catch {};
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self.vt.vt.scrollToBottom();
|
||||
self.vt.vt.update(.{ .key_press = key }) catch |e|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue