diff options
author | Charlie Groves | 2022-10-21 01:35:02 +0000 |
---|---|---|
committer | GitHub | 2022-10-21 01:35:02 +0000 |
commit | 7e29ee6daeb86fbd20a8b5eaae30b2e0f868147d (patch) | |
tree | 07babf558f7aea19346e49f2cdb5862ed62489ca /helix-term/src/application.rs | |
parent | 4ff5feeb0c6c1ce012aa1179a44f35b6f0df4da1 (diff) |
Autosave all when the terminal loses focus (#3178)
* Autosave all when the terminal loses focus
* Correct comment on focus config
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Need a block_try_flush_writes in all quit_all paths
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r-- | helix-term/src/application.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index b4b4a675..8ee0802f 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -37,8 +37,8 @@ use anyhow::{Context, Error}; use crossterm::{ event::{ - DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, - Event as CrosstermEvent, + DisableBracketedPaste, DisableFocusChange, DisableMouseCapture, EnableBracketedPaste, + EnableFocusChange, EnableMouseCapture, Event as CrosstermEvent, }, execute, terminal, tty::IsTty, @@ -102,6 +102,7 @@ fn restore_term() -> Result<(), Error> { execute!( stdout, DisableBracketedPaste, + DisableFocusChange, terminal::LeaveAlternateScreen )?; terminal::disable_raw_mode()?; @@ -925,7 +926,12 @@ impl Application { async fn claim_term(&mut self) -> Result<(), Error> { terminal::enable_raw_mode()?; let mut stdout = stdout(); - execute!(stdout, terminal::EnterAlternateScreen, EnableBracketedPaste)?; + execute!( + stdout, + terminal::EnterAlternateScreen, + EnableBracketedPaste, + EnableFocusChange + )?; execute!(stdout, terminal::Clear(terminal::ClearType::All))?; if self.config.load().editor.mouse { execute!(stdout, EnableMouseCapture)?; |