summaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index c55d4c98..5f350671 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -15,7 +15,7 @@ use std::{
use anyhow::Error;
use crossterm::{
- event::{Event, EventStream},
+ event::{DisableMouseCapture, EnableMouseCapture, Event, EventStream},
execute, terminal,
};
@@ -449,6 +449,9 @@ impl Application {
let mut stdout = stdout();
execute!(stdout, terminal::EnterAlternateScreen)?;
+ if self.config.terminal.mouse {
+ execute!(stdout, EnableMouseCapture)?;
+ }
// Exit the alternate screen and disable raw mode before panicking
let hook = std::panic::take_hook();
@@ -456,6 +459,7 @@ impl Application {
// We can't handle errors properly inside this closure. And it's
// probably not a good idea to `unwrap()` inside a panic handler.
// So we just ignore the `Result`s.
+ let _ = execute!(std::io::stdout(), DisableMouseCapture);
let _ = execute!(std::io::stdout(), terminal::LeaveAlternateScreen);
let _ = terminal::disable_raw_mode();
hook(info);
@@ -468,6 +472,7 @@ impl Application {
// reset cursor shape
write!(stdout, "\x1B[2 q")?;
+ execute!(stdout, DisableMouseCapture)?;
execute!(stdout, terminal::LeaveAlternateScreen)?;
terminal::disable_raw_mode()?;