Skip to content

Commit

Permalink
Merge pull request #1087 from mitchellh/close-quit
Browse files Browse the repository at this point in the history
core: quit-after-last-window-closed works properly with "exit"
  • Loading branch information
mitchellh authored Dec 14, 2023
2 parents cc6270f + b021d76 commit 18664b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
defer self.quit = false;

// We quit if our quit flag is on or if we have closed all surfaces.
return self.quit or self.surfaces.items.len == 0;
// We quit if our quit flag is on
return self.quit;
}

/// Update the configuration associated with the app. This can only be
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/glfw.zig
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub const App = struct {

// Tick the terminal app
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| {
surface.close(false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pub fn run(self: *App) !void {

// Tick the terminal app
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();
}
}

Expand Down

0 comments on commit 18664b6

Please sign in to comment.