refactor(terminal): shutdown terminal on exit or project switch
This commit is contained in:
parent
35ef58d0e1
commit
3ad37b3b70
2 changed files with 9 additions and 4 deletions
|
|
@ -125,6 +125,7 @@ pub fn create(allocator: std.mem.Allocator) CreateError!Widget {
|
|||
|
||||
pub fn deinit(self: *Self, allocator: std.mem.Allocator) void {
|
||||
self.close_all_panel_views();
|
||||
terminal_view.shutdown(allocator);
|
||||
self.commands.deinit();
|
||||
self.widgets.deinit(allocator);
|
||||
self.symbols.deinit(allocator);
|
||||
|
|
@ -498,6 +499,7 @@ const cmds = struct {
|
|||
{
|
||||
self.closing_project = true;
|
||||
defer self.closing_project = false;
|
||||
terminal_view.shutdown(self.allocator);
|
||||
try close_splits(self, .{});
|
||||
try self.close_all_editors();
|
||||
self.delete_all_buffers();
|
||||
|
|
|
|||
|
|
@ -177,15 +177,18 @@ pub fn unfocus(self: *Self) void {
|
|||
|
||||
pub fn deinit(self: *Self, allocator: Allocator) void {
|
||||
if (self.focused) tui.release_keyboard_focus(Widget.to(self));
|
||||
// if (state) |*p| {
|
||||
// p.deinit(self.allocator);
|
||||
// state = null;
|
||||
// }
|
||||
self.commands.unregister();
|
||||
self.plane.deinit();
|
||||
allocator.destroy(self);
|
||||
}
|
||||
|
||||
pub fn shutdown(allocator: Allocator) void {
|
||||
if (global_vt) |*vt| {
|
||||
vt.deinit(allocator);
|
||||
global_vt = null;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render(self: *Self, _: *const Widget.Theme) bool {
|
||||
// Drain the vt event queue.
|
||||
while (self.vt.vt.tryEvent()) |event| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue