Finished mouse compatability

This commit is contained in:
Mikayla Maki 2022-08-19 13:54:25 -07:00
parent 9f9bafd2a7
commit cfbda00cc4
5 changed files with 77 additions and 30 deletions

View file

@ -28,7 +28,7 @@ use mappings::mouse::{
alt_scroll, mouse_button_report, mouse_moved_report, mouse_point, mouse_side, scroll_report,
};
use modal::deploy_modal;
use settings::{Settings, Shell, TerminalBlink};
use settings::{AlternateScroll, Settings, Shell, TerminalBlink};
use std::{collections::HashMap, fmt::Display, ops::Sub, path::PathBuf, sync::Arc, time::Duration};
use thiserror::Error;
@ -263,6 +263,7 @@ impl TerminalBuilder {
env: Option<HashMap<String, String>>,
initial_size: TerminalSize,
blink_settings: Option<TerminalBlink>,
alternate_scroll: &AlternateScroll,
) -> Result<TerminalBuilder> {
let pty_config = {
let alac_shell = shell.clone().and_then(|shell| match shell {
@ -306,6 +307,14 @@ impl TerminalBuilder {
term.set_mode(alacritty_terminal::ansi::Mode::BlinkingCursor)
}
//Start alternate_scroll if we need to
if let AlternateScroll::On = alternate_scroll {
term.set_mode(alacritty_terminal::ansi::Mode::AlternateScroll)
} else {
//Alacritty turns it on by default, so we need to turn it off.
term.unset_mode(alacritty_terminal::ansi::Mode::AlternateScroll)
}
let term = Arc::new(FairMutex::new(term));
//Setup the pty...