From d707e064a97532b36c68088ba44cd8a10f6f71dc Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 12 Nov 2019 19:50:33 +0300 Subject: [PATCH] Fix mouse modes not being mutually exclusive --- CHANGELOG.md | 1 + alacritty_terminal/src/term/mod.rs | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a2c95..006000b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Underline/strikeout drawn above visual bell - Terminal going transparent during visual bell - Selection not being cleared when sending chars through a binding +- Mouse protocols/encodings not being mutually exclusive within themselves ### Removed diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 1622ece..858402a 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1878,22 +1878,33 @@ impl ansi::Handler for Term { }, ansi::Mode::ShowCursor => self.mode.insert(TermMode::SHOW_CURSOR), ansi::Mode::CursorKeys => self.mode.insert(TermMode::APP_CURSOR), + // Mouse protocols are mutually exlusive ansi::Mode::ReportMouseClicks => { + self.mode.remove(TermMode::MOUSE_MODE); self.mode.insert(TermMode::MOUSE_REPORT_CLICK); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportCellMouseMotion => { + self.mode.remove(TermMode::MOUSE_MODE); self.mode.insert(TermMode::MOUSE_DRAG); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportAllMouseMotion => { + self.mode.remove(TermMode::MOUSE_MODE); self.mode.insert(TermMode::MOUSE_MOTION); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportFocusInOut => self.mode.insert(TermMode::FOCUS_IN_OUT), ansi::Mode::BracketedPaste => self.mode.insert(TermMode::BRACKETED_PASTE), - ansi::Mode::SgrMouse => self.mode.insert(TermMode::SGR_MOUSE), - ansi::Mode::Utf8Mouse => self.mode.insert(TermMode::UTF8_MOUSE), + // Mouse encodings are mutually exlusive + ansi::Mode::SgrMouse => { + self.mode.remove(TermMode::UTF8_MOUSE); + self.mode.insert(TermMode::SGR_MOUSE); + }, + ansi::Mode::Utf8Mouse => { + self.mode.remove(TermMode::SGR_MOUSE); + self.mode.insert(TermMode::UTF8_MOUSE); + }, ansi::Mode::AlternateScroll => self.mode.insert(TermMode::ALTERNATE_SCROLL), ansi::Mode::LineWrap => self.mode.insert(TermMode::LINE_WRAP), ansi::Mode::LineFeedNewLine => self.mode.insert(TermMode::LINE_FEED_NEW_LINE),