diff options
author | Chet Gurevitch <chetgurevitch@protonmail.com> | 2017-10-11 18:52:23 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-23 21:39:09 -0800 |
commit | 76ca679e89cd7f431652e06892b791b5f8c43cf9 (patch) | |
tree | f4594990e94f8cfc94d90dd965cd14fe916557bc | |
parent | ae533e660f649413af15c2a826497de423a5211b (diff) |
Update bitflags to v1
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/config.rs | 8 | ||||
-rw-r--r-- | src/input.rs | 54 | ||||
-rw-r--r-- | src/renderer/mod.rs | 6 | ||||
-rw-r--r-- | src/term/cell.rs | 12 | ||||
-rw-r--r-- | src/term/mod.rs | 124 |
7 files changed, 104 insertions, 104 deletions
@@ -11,7 +11,7 @@ name = "alacritty" version = "0.1.0" dependencies = [ "arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "cgmath 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.177 (registry+https://github.com/rust-lang/crates.io-index)", @@ -15,7 +15,7 @@ name = "alacritty" libc = "0.2" cgmath = "0.15" notify = "4" -bitflags = "0.9" +bitflags = "1" font = { path = "./font" } errno = "0.2" parking_lot = "0.5" diff --git a/src/config.rs b/src/config.rs index d8f96fce..7d3fa16f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -505,10 +505,10 @@ impl<'a> de::Deserialize<'a> for ModeWrapper { for modifier in value.split('|') { match modifier.trim() { - "AppCursor" => res.mode |= mode::APP_CURSOR, - "~AppCursor" => res.not_mode |= mode::APP_CURSOR, - "AppKeypad" => res.mode |= mode::APP_KEYPAD, - "~AppKeypad" => res.not_mode |= mode::APP_KEYPAD, + "AppCursor" => res.mode |= mode::TermMode::APP_CURSOR, + "~AppCursor" => res.not_mode |= mode::TermMode::APP_CURSOR, + "AppKeypad" => res.mode |= mode::TermMode::APP_KEYPAD, + "~AppKeypad" => res.not_mode |= mode::TermMode::APP_KEYPAD, _ => eprintln!("unknown mode {:?}", modifier), } } diff --git a/src/input.rs b/src/input.rs index bc172bca..1090f12d 100644 --- a/src/input.rs +++ b/src/input.rs @@ -226,7 +226,7 @@ impl Action { } fn paste<A: ActionContext>(&self, ctx: &mut A, contents: String) { - if ctx.terminal_mode().contains(mode::BRACKETED_PASTE) { + if ctx.terminal_mode().contains(mode::TermMode::BRACKETED_PASTE) { ctx.write_to_pty(&b"\x1b[200~"[..]); ctx.write_to_pty(contents.into_bytes()); ctx.write_to_pty(&b"\x1b[201~"[..]); @@ -264,13 +264,13 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { self.ctx.mouse_mut().cell_side = cell_side; if self.ctx.mouse_mut().left_button_state == ElementState::Pressed { - let report_mode = mode::MOUSE_REPORT_CLICK | mode::MOUSE_MOTION; + let report_mode = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION; if !self.ctx.terminal_mode().intersects(report_mode) { self.ctx.update_selection(Point { line: point.line, col: point.col }, cell_side); - } else if self.ctx.terminal_mode().contains(mode::MOUSE_MOTION) + } else if self.ctx.terminal_mode().contains(mode::TermMode::MOUSE_MOTION) // Only report motion when changing cells && ( prev_line != self.ctx.mouse_mut().line @@ -308,7 +308,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } pub fn mouse_report(&mut self, button: u8) { - if self.ctx.terminal_mode().contains(mode::SGR_MOUSE) { + if self.ctx.terminal_mode().contains(mode::TermMode::SGR_MOUSE) { let release = self.ctx.mouse_mut().left_button_state != ElementState::Pressed; self.sgr_mouse_report(button, release); } else { @@ -343,7 +343,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { ClickState::TripleClick }, _ => { - let report_modes = mode::MOUSE_REPORT_CLICK | mode::MOUSE_MOTION; + let report_modes = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION; if self.ctx.terminal_mode().intersects(report_modes) { self.mouse_report(0); return; @@ -356,7 +356,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } pub fn on_mouse_release(&mut self) { - if self.ctx.terminal_mode().intersects(mode::MOUSE_REPORT_CLICK | mode::MOUSE_MOTION) { + if self.ctx.terminal_mode().intersects(mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION) { self.mouse_report(3); return; } @@ -365,8 +365,8 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } pub fn on_mouse_wheel(&mut self, delta: MouseScrollDelta, phase: TouchPhase) { - let modes = mode::MOUSE_REPORT_CLICK | mode::MOUSE_MOTION | mode::SGR_MOUSE | - mode::ALT_SCREEN; + let modes = mode::TermMode::MOUSE_REPORT_CLICK | mode::TermMode::MOUSE_MOTION | mode::TermMode::SGR_MOUSE | + mode::TermMode::ALT_SCREEN; if !self.ctx.terminal_mode().intersects(modes) { return; } @@ -381,7 +381,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { }; for _ in 0..(to_scroll.abs() as usize) { - if self.ctx.terminal_mode().intersects(mode::ALT_SCREEN) { + if self.ctx.terminal_mode().intersects(mode::TermMode::ALT_SCREEN) { // Faux scrolling if code == 64 { // Scroll up one line @@ -416,7 +416,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { 65 }; - if self.ctx.terminal_mode().intersects(mode::ALT_SCREEN) { + if self.ctx.terminal_mode().intersects(mode::TermMode::ALT_SCREEN) { // Faux scrolling if button == 64 { // Scroll up one line @@ -437,7 +437,7 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> { } pub fn on_focus_change(&mut self, is_focused: bool) { - if self.ctx.terminal_mode().contains(mode::FOCUS_IN_OUT) { + if self.ctx.terminal_mode().contains(mode::TermMode::FOCUS_IN_OUT) { let chr = if is_focused { "I" } else { @@ -772,65 +772,65 @@ mod tests { test_process_binding! { name: process_binding_nomode_shiftmod_require_shift, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: mode::NONE, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: mode::TermMode::NONE, notmode: mode::TermMode::NONE }, triggers: true, - mode: mode::NONE, + mode: mode::TermMode::NONE, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false } } test_process_binding! { name: process_binding_nomode_nomod_require_shift, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: mode::NONE, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: true, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[1;2D"), mode: mode::TermMode::NONE, notmode: mode::TermMode::NONE }, triggers: false, - mode: mode::NONE, + mode: mode::TermMode::NONE, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } test_process_binding! { name: process_binding_nomode_controlmod, - binding: Binding { trigger: KEY, mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false }, action: Action::from("\x1b[1;5D"), mode: mode::NONE, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false }, action: Action::from("\x1b[1;5D"), mode: mode::TermMode::NONE, notmode: mode::TermMode::NONE }, triggers: true, - mode: mode::NONE, + mode: mode::TermMode::NONE, mods: ModifiersState { ctrl: true, shift: false, alt: false, logo: false } } test_process_binding! { name: process_binding_nomode_nomod_require_not_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[D"), mode: mode::NONE, notmode: mode::APP_CURSOR }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1b[D"), mode: mode::TermMode::NONE, notmode: mode::TermMode::APP_CURSOR }, triggers: true, - mode: mode::NONE, + mode: mode::TermMode::NONE, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } test_process_binding! { name: process_binding_appcursormode_nomod_require_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::TermMode::APP_CURSOR, notmode: mode::TermMode::NONE }, triggers: true, - mode: mode::APP_CURSOR, + mode: mode::TermMode::APP_CURSOR, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } test_process_binding! { name: process_binding_nomode_nomod_require_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::TermMode::APP_CURSOR, notmode: mode::TermMode::NONE }, triggers: false, - mode: mode::NONE, + mode: mode::TermMode::NONE, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } test_process_binding! { name: process_binding_appcursormode_appkeypadmode_nomod_require_appcursor, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::APP_CURSOR, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false }, action: Action::from("\x1bOD"), mode: mode::TermMode::APP_CURSOR, notmode: mode::TermMode::NONE }, triggers: true, - mode: mode::APP_CURSOR | mode::APP_KEYPAD, + mode: mode::TermMode::APP_CURSOR | mode::TermMode::APP_KEYPAD, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: false } } test_process_binding! { name: process_binding_fail_with_extra_mods, - binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: true }, action: Action::from("arst"), mode: mode::NONE, notmode: mode::NONE }, + binding: Binding { trigger: KEY, mods: ModifiersState { shift: false, ctrl: false, alt: false, logo: true }, action: Action::from("arst"), mode: mode::TermMode::NONE, notmode: mode::TermMode::NONE }, triggers: false, - mode: mode::NONE, + mode: mode::TermMode::NONE, mods: ModifiersState { shift: false, ctrl: false, alt: true, logo: true } } } diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index bb2edf15..afc4da97 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -828,9 +828,9 @@ impl<'a> RenderApi<'a> { // Get font key for cell // FIXME this is super inefficient. let mut font_key = glyph_cache.font_key; - if cell.flags.contains(cell::BOLD) { + if cell.flags.contains(cell::Flags::BOLD) { font_key = glyph_cache.bold_key; - } else if cell.flags.contains(cell::ITALIC) { + } else if cell.flags.contains(cell::Flags::ITALIC) { font_key = glyph_cache.italic_key; } @@ -849,7 +849,7 @@ impl<'a> RenderApi<'a> { // FIXME This is a super hacky way to do underlined text. During // a time crunch to release 0.1, this seemed like a really // easy, clean hack. - if cell.flags.contains(cell::UNDERLINE) { + if cell.flags.contains(cell::Flags::UNDERLINE) { let glyph_key = GlyphKey { font_key: font_key, size: glyph_cache.font_size, diff --git a/src/term/cell.rs b/src/term/cell.rs index cc1848d3..7ad2aed0 100644 --- a/src/term/cell.rs +++ b/src/term/cell.rs @@ -59,7 +59,7 @@ impl LineLength for grid::Row<Cell> { fn line_length(&self) -> Column { let mut length = Column(0); - if self[Column(self.len() - 1)].flags.contains(WRAPLINE) { + if self[Column(self.len() - 1)].flags.contains(Flags::WRAPLINE) { return Column(self.len()); } @@ -77,17 +77,17 @@ impl LineLength for grid::Row<Cell> { impl Cell { #[inline] pub fn bold(&self) -> bool { - self.flags.contains(BOLD) + self.flags.contains(Flags::BOLD) } #[inline] pub fn inverse(&self) -> bool { - self.flags.contains(INVERSE) + self.flags.contains(Flags::INVERSE) } #[inline] pub fn dim(&self) -> bool { - self.flags.contains(DIM) + self.flags.contains(Flags::DIM) } pub fn new(c: char, fg: Color, bg: Color) -> Cell { @@ -103,7 +103,7 @@ impl Cell { pub fn is_empty(&self) -> bool { self.c == ' ' && self.bg == Color::Named(NamedColor::Background) && - !self.flags.intersects(INVERSE | UNDERLINE) + !self.flags.intersects(Flags::INVERSE | Flags::UNDERLINE) } #[inline] @@ -133,7 +133,7 @@ mod tests { fn line_length_works_with_wrapline() { let template = Cell::default(); let mut row = Row::new(Column(10), &template); - row[Column(9)].flags.insert(super::WRAPLINE); + row[Column(9)].flags.insert(super::Flags::WRAPLINE); assert_eq!(row.line_length(), Column(10)); } diff --git a/src/term/mod.rs b/src/term/mod.rs index eb25efd6..18858da5 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -44,7 +44,7 @@ impl<'a> selection::SemanticSearch for &'a Term { break; } - if iter.cur.col == last_col && !cell.flags.contains(cell::WRAPLINE) { + if iter.cur.col == last_col && !cell.flags.contains(cell::Flags::WRAPLINE) { break; // cut off if on new line or hit escape char } @@ -65,7 +65,7 @@ impl<'a> selection::SemanticSearch for &'a Term { point = iter.cur; - if iter.cur.col == last_col && !cell.flags.contains(cell::WRAPLINE) { + if iter.cur.col == last_col && !cell.flags.contains(cell::Flags::WRAPLINE) { break; // cut off if on new line or hit escape char } } @@ -168,7 +168,7 @@ impl<'a> RenderableCellsIter<'a> { #[inline] fn is_wide_cursor(&self, cell: &Cell) -> bool { - cell.flags.contains(cell::WIDE_CHAR) && (self.cursor.col + 1) < self.grid.num_cols() + cell.flags.contains(cell::Flags::WIDE_CHAR) && (self.cursor.col + 1) < self.grid.num_cols() } fn populate_beam_cursor(&mut self) { @@ -264,20 +264,20 @@ impl<'a> RenderableCellsIter<'a> { /// Check if the cursor should be rendered. #[inline] fn cursor_is_visible(&self) -> bool { - self.mode.contains(mode::SHOW_CURSOR) && self.grid.contains(self.cursor) + self.mode.contains(mode::TermMode::SHOW_CURSOR) && self.grid.contains(self.cursor) } fn compute_fg_rgb(&self, fg: &Color, cell: &Cell) -> Rgb { - use self::cell::DIM_BOLD; + use self::cell::Flags; match *fg { Color::Spec(rgb) => rgb, Color::Named(ansi) => { - match (self.config.draw_bold_text_with_bright_colors(), cell.flags & DIM_BOLD) { + match (self.config.draw_bold_text_with_bright_colors(), cell.flags & Flags::DIM_BOLD) { // Draw bold text in bright colors *and* contains bold flag. - (true, self::cell::DIM_BOLD) | - (true, self::cell::BOLD) => self.colors[ansi.to_bright()], + (true, self::cell::Flags::DIM_BOLD) | + (true, self::cell::Flags::BOLD) => self.colors[ansi.to_bright()], // Cell is marked as dim and not bold - (_, self::cell::DIM) => self.colors[ansi.to_dim()], + (_, self::cell::Flags::DIM) => self.colors[ansi.to_dim()], // None of the above, keep original color. _ => self.colors[ansi] } @@ -285,12 +285,12 @@ impl<'a> RenderableCellsIter<'a> { Color::Indexed(idx) => { let idx = match ( self.config.draw_bold_text_with_bright_colors(), - cell.flags & DIM_BOLD, + cell.flags & Flags::DIM_BOLD, idx ) { - (true, self::cell::BOLD, 0...7) => idx as usize + 8, - (false, self::cell::DIM, 8...15) => idx as usize - 8, - (false, self::cell::DIM, 0...7) => idx as usize + 260, + (true, self::cell::Flags::BOLD, 0...7) => idx as usize + 8, + (false, self::cell::Flags::DIM, 8...15) => idx as usize - 8, + (false, self::cell::Flags::DIM, 0...7) => idx as usize + 260, _ => idx as usize, }; @@ -436,7 +436,7 @@ pub mod mode { impl Default for TermMode { fn default() -> TermMode { - SHOW_CURSOR | LINE_WRAP + TermMode::SHOW_CURSOR | TermMode::LINE_WRAP } } } @@ -854,7 +854,7 @@ impl Term { trait PushChar { fn push_char(&mut self, c: char); fn maybe_newline(&mut self, grid: &Grid<Cell>, line: Line, ending: Column) { - if ending != Column(0) && !grid[line][ending - 1].flags.contains(cell::WRAPLINE) { + if ending != Column(0) && !grid[line][ending - 1].flags.contains(cell::Flags::WRAPLINE) { self.push_char('\n'); } } @@ -888,7 +888,7 @@ impl Term { None } else { for cell in &grid_line[cols.start..line_end] { - if !cell.flags.contains(cell::WIDE_CHAR_SPACER) { + if !cell.flags.contains(cell::Flags::WIDE_CHAR_SPACER) { self.push(cell.c); } } @@ -1175,7 +1175,7 @@ impl ansi::Handler for Term { #[inline] fn input(&mut self, c: char) { if self.input_needs_wrap { - if !self.mode.contains(mode::LINE_WRAP) { + if !self.mode.contains(mode::TermMode::LINE_WRAP) { return; } @@ -1188,7 +1188,7 @@ impl ansi::Handler for Term { }; let cell = &mut self.grid[&location]; - cell.flags.insert(cell::WRAPLINE); + cell.flags.insert(cell::Flags::WRAPLINE); } if (self.cursor.point.line + 1) >= self.scroll_region.end { @@ -1209,7 +1209,7 @@ impl ansi::Handler for Term { let num_cols = self.grid.num_cols(); { // If in insert mode, first shift cells to the right. - if self.mode.contains(mode::INSERT) && self.cursor.point.col + width < num_cols { + if self.mode.contains(mode::TermMode::INSERT) && self.cursor.point.col + width < num_cols { let line = self.cursor.point.line; // borrowck let col = self.cursor.point.col; let line = &mut self.grid[line]; @@ -1228,7 +1228,7 @@ impl ansi::Handler for Term { // Handle wide chars if width == 2 { - cell.flags.insert(cell::WIDE_CHAR); + cell.flags.insert(cell::Flags::WIDE_CHAR); } } @@ -1238,7 +1238,7 @@ impl ansi::Handler for Term { self.cursor.point.col += 1; let spacer = &mut self.grid[&self.cursor.point]; *spacer = self.cursor.template; - spacer.flags.insert(cell::WIDE_CHAR_SPACER); + spacer.flags.insert(cell::Flags::WIDE_CHAR_SPACER); } } } @@ -1268,7 +1268,7 @@ impl ansi::Handler for Term { #[inline] fn goto(&mut self, line: Line, col: Column) { trace!("goto: line={}, col={}", line, col); - let (y_offset, max_y) = if self.mode.contains(mode::ORIGIN) { + let (y_offset, max_y) = if self.mode.contains(mode::TermMode::ORIGIN) { (self.scroll_region.start, self.scroll_region.end - 1) } else { (Line(0), self.grid.num_lines() - 1) @@ -1474,7 +1474,7 @@ impl ansi::Handler for Term { fn newline(&mut self) { self.linefeed(); - if self.mode.contains(mode::LINE_FEED_NEW_LINE) { + if self.mode.contains(mode::TermMode::LINE_FEED_NEW_LINE) { self.carriage_return(); } } @@ -1740,16 +1740,16 @@ impl ansi::Handler for Term { self.cursor.template.bg = Color::Named(NamedColor::Background); self.cursor.template.flags = cell::Flags::empty(); }, - Attr::Reverse => self.cursor.template.flags.insert(cell::INVERSE), - Attr::CancelReverse => self.cursor.template.flags.remove(cell::INVERSE), - Attr::Bold => self.cursor.template.flags.insert(cell::BOLD), - Attr::CancelBold => self.cursor.template.flags.remove(cell::BOLD), - Attr::Dim => self.cursor.template.flags.insert(cell::DIM), - Attr::CancelBoldDim => self.cursor.template.flags.remove(cell::BOLD | cell::DIM), - Attr::Italic => self.cursor.template.flags.insert(cell::ITALIC), - Attr::CancelItalic => self.cursor.template.flags.remove(cell::ITALIC), - Attr::Underscore => self.cursor.template.flags.insert(cell::UNDERLINE), - Attr::CancelUnderline => self.cursor.template.flags.remove(cell::UNDERLINE), + Attr::Reverse => self.cursor.template.flags.insert(cell::Flags::INVERSE), + Attr::CancelReverse => self.cursor.template.flags.remove(cell::Flags::INVERSE), + Attr::Bold => self.cursor.template.flags.insert(cell::Flags::BOLD), + Attr::CancelBold => self.cursor.template.flags.remove(cell::Flags::BOLD), + Attr::Dim => self.cursor.template.flags.insert(cell::Flags::DIM), + Attr::CancelBoldDim => self.cursor.template.flags.remove(cell::Flags::BOLD | cell::Flags::DIM), + Attr::Italic => self.cursor.template.flags.insert(cell::Flags::ITALIC), + Attr::CancelItalic => self.cursor.template.flags.remove(cell::Flags::ITALIC), + Attr::Underscore => self.cursor.template.flags.insert(cell::Flags::UNDERLINE), + Attr::CancelUnderline => self.cursor.template.flags.remove(cell::Flags::UNDERLINE), _ => { debug!("Term got unhandled attr: {:?}", attr); } @@ -1761,25 +1761,25 @@ impl ansi::Handler for Term { trace!("set_mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => { - self.mode.insert(mode::ALT_SCREEN); + self.mode.insert(mode::TermMode::ALT_SCREEN); self.save_cursor_position(); if !self.alt { self.swap_alt(); } self.save_cursor_position(); }, - ansi::Mode::ShowCursor => self.mode.insert(mode::SHOW_CURSOR), - ansi::Mode::CursorKeys => self.mode.insert(mode::APP_CURSOR), - ansi::Mode::ReportMouseClicks => self.mode.insert(mode::MOUSE_REPORT_CLICK), - ansi::Mode::ReportMouseMotion => self.mode.insert(mode::MOUSE_MOTION), - ansi::Mode::ReportFocusInOut => self.mode.insert(mode::FOCUS_IN_OUT), - ansi::Mode::BracketedPaste => self.mode.insert(mode::BRACKETED_PASTE), - ansi::Mode::SgrMouse => self.mode.insert(mode::SGR_MOUSE), - ansi::Mode::LineWrap => self.mode.insert(mode::LINE_WRAP), - ansi::Mode::LineFeedNewLine => self.mode.insert(mode::LINE_FEED_NEW_LINE), - ansi::Mode::Origin => self.mode.insert(mode::ORIGIN), + ansi::Mode::ShowCursor => self.mode.insert(mode::TermMode::SHOW_CURSOR), + ansi::Mode::CursorKeys => self.mode.insert(mode::TermMode::APP_CURSOR), + ansi::Mode::ReportMouseClicks => self.mode.insert(mode::TermMode::MOUSE_REPORT_CLICK), + ansi::Mode::ReportMouseMotion => self.mode.insert(mode::TermMode::MOUSE_MOTION), + ansi::Mode::ReportFocusInOut => self.mode.insert(mode::TermMode::FOCUS_IN_OUT), + ansi::Mode::BracketedPaste => self.mode.insert(mode::TermMode::BRACKETED_PASTE), + ansi::Mode::SgrMouse => self.mode.insert(mode::TermMode::SGR_MOUSE), + ansi::Mode::LineWrap => self.mode.insert(mode::TermMode::LINE_WRAP), + ansi::Mode::LineFeedNewLine => self.mode.insert(mode::TermMode::LINE_FEED_NEW_LINE), + ansi::Mode::Origin => self.mode.insert(mode::TermMode::ORIGIN), ansi::Mode::DECCOLM => self.deccolm(), - ansi::Mode::Insert => self.mode.insert(mode::INSERT), // heh + ansi::Mode::Insert => self.mode.insert(mode::TermMode::INSERT), // heh _ => { trace!(".. ignoring set_mode"); } @@ -1791,25 +1791,25 @@ impl ansi::Handler for Term { trace!("unset_mode: {:?}", mode); match mode { ansi::Mode::SwapScreenAndSetRestoreCursor => { - self.mode.remove(mode::ALT_SCREEN); + self.mode.remove(mode::TermMode::ALT_SCREEN); self.restore_cursor_position(); if self.alt { self.swap_alt(); } self.restore_cursor_position(); }, - ansi::Mode::ShowCursor => self.mode.remove(mode::SHOW_CURSOR), - ansi::Mode::CursorKeys => self.mode.remove(mode::APP_CURSOR), - ansi::Mode::ReportMouseClicks => self.mode.remove(mode::MOUSE_REPORT_CLICK), - ansi::Mode::ReportMouseMotion => self.mode.remove(mode::MOUSE_MOTION), - ansi::Mode::ReportFocusInOut => self.mode.remove(mode::FOCUS_IN_OUT), - ansi::Mode::BracketedPaste => self.mode.remove(mode::BRACKETED_PASTE), - ansi::Mode::SgrMouse => self.mode.remove(mode::SGR_MOUSE), - ansi::Mode::LineWrap => self.mode.remove(mode::LINE_WRAP), - ansi::Mode::LineFeedNewLine => self.mode.remove(mode::LINE_FEED_NEW_LINE), - ansi::Mode::Origin => self.mode.remove(mode::ORIGIN), + ansi::Mode::ShowCursor => self.mode.remove(mode::TermMode::SHOW_CURSOR), + ansi::Mode::CursorKeys => self.mode.remove(mode::TermMode::APP_CURSOR), + ansi::Mode::ReportMouseClicks => self.mode.remove(mode::TermMode::MOUSE_REPORT_CLICK), + ansi::Mode::ReportMouseMotion => self.mode.remove(mode::TermMode::MOUSE_MOTION), + ansi::Mode::ReportFocusInOut => self.mode.remove(mode::TermMode::FOCUS_IN_OUT), + ansi::Mode::BracketedPaste => self.mode.remove(mode::TermMode::BRACKETED_PASTE), + ansi::Mode::SgrMouse => self.mode.remove(mode::TermMode::SGR_MOUSE), + ansi::Mode::LineWrap => self.mode.remove(mode::TermMode::LINE_WRAP), + ansi::Mode::LineFeedNewLine => self.mode.remove(mode::TermMode::LINE_FEED_NEW_LINE), + ansi::Mode::Origin => self.mode.remove(mode::TermMode::ORIGIN), ansi::Mode::DECCOLM => self.deccolm(), - ansi::Mode::Insert => self.mode.remove(mode::INSERT), + ansi::Mode::Insert => self.mode.remove(mode::TermMode::INSERT), _ => { trace!(".. ignoring unset_mode"); } @@ -1826,14 +1826,14 @@ impl ansi::Handler for Term { #[inline] fn set_keypad_application_mode(&mut self) { - trace!("set mode::APP_KEYPAD"); - self.mode.insert(mode::APP_KEYPAD); + trace!("set mode::TermMode::APP_KEYPAD"); + self.mode.insert(mode::TermMode::APP_KEYPAD); } #[inline] fn unset_keypad_application_mode(&mut self) { - trace!("unset mode::APP_KEYPAD"); - self.mode.remove(mode::APP_KEYPAD); + trace!("unset mode::TermMode::APP_KEYPAD"); + self.mode.remove(mode::TermMode::APP_KEYPAD); } #[inline] @@ -1888,7 +1888,7 @@ mod tests { grid[Line(0)][Column(0)].c = '"'; grid[Line(0)][Column(3)].c = '"'; grid[Line(1)][Column(2)].c = '"'; - grid[Line(0)][Column(4)].flags.insert(cell::WRAPLINE); + grid[Line(0)][Column(4)].flags.insert(cell::Flags::WRAPLINE); let mut escape_chars = String::from("\""); |