Skip to content

Commit

Permalink
QuitApplication now respects window_close_confirmation
Browse files Browse the repository at this point in the history
closes: #398
closes: #280
  • Loading branch information
wez committed Dec 26, 2020
1 parent b3ac77a commit 586d18c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ brief notes about them may accumulate here.
* The 256 color cube now uses slightly brighter colors [#348](https://github.com/wez/wezterm/issues/348)
* New: added `line_height` configuration option to scale the computed cell height. The default is `1.0`, resulting in using the font-specified metrics. Setting it to `1.2` will result in a 20% larger cell height.
* macOS: Fixed an issue where hovering over the split between panes could result in wezterm becoming unresponsive [#391](https://github.com/wez/wezterm/issues/391)
* Closing windows will now prompt for confirmation before proceeding with the close. Added `window_close_confirmation` to control this; valid values are `AlwaysPrompt` and `NeverPrompt`. [#280](https://github.com/wez/wezterm/issues/280)
* Closing windows and `QuitApplication` will now prompt for confirmation before proceeding with the close/quit. Added `window_close_confirmation` to control this; valid values are `AlwaysPrompt` and `NeverPrompt`. [#280](https://github.com/wez/wezterm/issues/280)
* Tidied up logging. Previously ERROR level logging was used to make sure that informational things showed up in the stderr stream. Now we use INFO level logging for this to avoid alarming the user. You can set `WEZTERM_LOG=trace` in the environment to get more verbose logging for troubleshooting purposes.
* Windows: fix an issue where VNC-server-emulated AltGr was not treated as AltGr [#392](https://github.com/wez/wezterm/issues/392)
* X11: fix an issue where keys that produce unicode characters retained SHIFT as a modifier instead of normalizing it away. [#394](https://github.com/wez/wezterm/issues/394)
Expand Down
27 changes: 19 additions & 8 deletions wezterm-gui/src/gui/termwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1974,15 +1974,26 @@ impl TermWindow {
}
QuitApplication => {
let mux = Mux::get().unwrap();
let tab = match mux.get_active_tab_for_window(self.mux_window_id) {
Some(tab) => tab,
None => anyhow::bail!("no active tab!?"),
};
let config = configuration();

let (overlay, future) =
start_overlay(self, &tab, move |_tab_id, term| confirm_quit_program(term));
self.assign_overlay(tab.tab_id(), overlay);
promise::spawn::spawn(future).detach();
match config.window_close_confirmation {
WindowCloseConfirmation::NeverPrompt => {
let con = Connection::get().expect("call on gui thread");
con.terminate_message_loop();
}
WindowCloseConfirmation::AlwaysPrompt => {
let tab = match mux.get_active_tab_for_window(self.mux_window_id) {
Some(tab) => tab,
None => anyhow::bail!("no active tab!?"),
};

let (overlay, future) = start_overlay(self, &tab, move |_tab_id, term| {
confirm_quit_program(term)
});
self.assign_overlay(tab.tab_id(), overlay);
promise::spawn::spawn(future).detach();
}
}
}
SelectTextAtMouseCursor(mode) => self.select_text_at_mouse_cursor(*mode, pane),
ExtendSelectionToMouseCursor(mode) => {
Expand Down

0 comments on commit 586d18c

Please sign in to comment.