Merge pull request #1087 from mitchellh/close-quit

core: quit-after-last-window-closed works properly with "exit"
This commit is contained in:
Mitchell Hashimoto
2023-12-13 16:36:45 -08:00
committed by GitHub
3 changed files with 4 additions and 4 deletions

View File

@ -103,8 +103,8 @@ pub fn tick(self: *App, rt_app: *apprt.App) !bool {
// doesn't want to quit, then we can't force it to. // doesn't want to quit, then we can't force it to.
defer self.quit = false; defer self.quit = false;
// We quit if our quit flag is on or if we have closed all surfaces. // We quit if our quit flag is on
return self.quit or self.surfaces.items.len == 0; return self.quit;
} }
/// Update the configuration associated with the app. This can only be /// Update the configuration associated with the app. This can only be

View File

@ -111,7 +111,7 @@ pub const App = struct {
// Tick the terminal app // Tick the terminal app
const should_quit = try self.app.tick(self); const should_quit = try self.app.tick(self);
if (should_quit) { if (should_quit or self.app.surfaces.items.len == 0) {
for (self.app.surfaces.items) |surface| { for (self.app.surfaces.items) |surface| {
surface.close(false); surface.close(false);
} }

View File

@ -316,7 +316,7 @@ pub fn run(self: *App) !void {
// Tick the terminal app // Tick the terminal app
const should_quit = try self.core_app.tick(self); const should_quit = try self.core_app.tick(self);
if (should_quit) self.quit(); if (should_quit or self.core_app.surfaces.items.len == 0) self.quit();
} }
} }