diff options
author | Joe Wilm <joe@jwilm.com> | 2016-06-23 09:42:00 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-06-23 09:43:55 -0700 |
commit | 09600a3d402a08c94803c00624fa7ac7bcfad73e (patch) | |
tree | 5eb6bede5318f300fc40aadf9b215b80c1c4894f /src/term.rs | |
parent | f5faa40066e87d615e35dd3d62b96ccc9a49e705 (diff) | |
download | r-alacritty-09600a3d402a08c94803c00624fa7ac7bcfad73e.tar.gz r-alacritty-09600a3d402a08c94803c00624fa7ac7bcfad73e.tar.bz2 r-alacritty-09600a3d402a08c94803c00624fa7ac7bcfad73e.zip |
Fix bug handling ansi mode sequences
The sense of set_mode and unset_mode was inverted. The
TextCursor/ShowCursor mode depended on the incorrect behavior, and that
was fixed as well. TextCursor was renamed to ShowCursor to be perfectly
clear on the intent.
Diffstat (limited to 'src/term.rs')
-rw-r--r-- | src/term.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/term.rs b/src/term.rs index 3dbd94a0..56c34f6a 100644 --- a/src/term.rs +++ b/src/term.rs @@ -30,8 +30,17 @@ pub static COLORS: &'static [Rgb] = &[ pub mod mode { bitflags! { - pub flags TermMode: u32 { - const TEXT_CURSOR = 0b00000001, + pub flags TermMode: u8 { + const SHOW_CURSOR = 0b00000001, + const APP_CURSOR = 0b00000010, + const ANY = 0b11111111, + const NONE = 0b00000000, + } + } + + impl Default for TermMode { + fn default() -> TermMode { + SHOW_CURSOR } } } @@ -128,7 +137,7 @@ impl Term { _tty: tty, tabs: tabs, attr: CellFlags::empty(), - mode: TermMode::empty(), + mode: Default::default(), scroll_region: scroll_region, } } @@ -429,7 +438,7 @@ impl ansi::Handler for Term { println!("set_mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => self.swap_alt(), - ansi::Mode::TextCursor => self.mode.insert(mode::TEXT_CURSOR), + ansi::Mode::ShowCursor => self.mode.insert(mode::SHOW_CURSOR), _ => { println!(".. ignoring set_mode"); } @@ -440,7 +449,7 @@ impl ansi::Handler for Term { println!("unset_mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => self.swap_alt(), - ansi::Mode::TextCursor => self.mode.remove(mode::TEXT_CURSOR), + ansi::Mode::ShowCursor => self.mode.remove(mode::SHOW_CURSOR), _ => { println!(".. ignoring unset_mode"); } |