diff options
Diffstat (limited to 'alacritty/src')
-rw-r--r-- | alacritty/src/display.rs | 4 | ||||
-rw-r--r-- | alacritty/src/event.rs | 14 | ||||
-rw-r--r-- | alacritty/src/input.rs | 2 | ||||
-rw-r--r-- | alacritty/src/url.rs | 14 | ||||
-rw-r--r-- | alacritty/src/window.rs | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/alacritty/src/display.rs b/alacritty/src/display.rs index 13e0454a..5e0747f3 100644 --- a/alacritty/src/display.rs +++ b/alacritty/src/display.rs @@ -414,7 +414,7 @@ impl Display { let glyph_cache = &mut self.glyph_cache; let size_info = self.size_info; - let selection = !terminal.selection().as_ref().map(Selection::is_empty).unwrap_or(true); + let selection = !terminal.selection.as_ref().map(Selection::is_empty).unwrap_or(true); let mouse_mode = terminal.mode().intersects(TermMode::MOUSE_MODE) && !terminal.mode().contains(TermMode::VI); @@ -446,7 +446,7 @@ impl Display { // Iterate over all non-empty cells in the grid. for cell in grid_cells { // Update URL underlines. - urls.update(size_info.cols().0, cell); + urls.update(size_info.cols(), cell); // Update underline/strikeout. lines.update(cell); diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index e11903ef..0de130b9 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -95,7 +95,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon // Update selection. if self.terminal.mode().contains(TermMode::VI) - && self.terminal.selection().as_ref().map(|s| s.is_empty()) != Some(true) + && self.terminal.selection.as_ref().map(|s| s.is_empty()) != Some(true) { self.update_selection(self.terminal.vi_mode_cursor.point, Side::Right); } else if ElementState::Pressed == self.mouse().left_button_state { @@ -116,11 +116,11 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon } fn selection_is_empty(&self) -> bool { - self.terminal.selection().as_ref().map(Selection::is_empty).unwrap_or(true) + self.terminal.selection.as_ref().map(Selection::is_empty).unwrap_or(true) } fn clear_selection(&mut self) { - *self.terminal.selection_mut() = None; + self.terminal.selection = None; self.terminal.dirty = true; } @@ -129,7 +129,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon // Update selection if one exists. let vi_mode = self.terminal.mode().contains(TermMode::VI); - if let Some(selection) = self.terminal.selection_mut() { + if let Some(selection) = &mut self.terminal.selection { selection.update(point, side); if vi_mode { @@ -142,12 +142,12 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon fn start_selection(&mut self, ty: SelectionType, point: Point, side: Side) { let point = self.terminal.visible_to_buffer(point); - *self.terminal.selection_mut() = Some(Selection::new(ty, point, side)); + self.terminal.selection = Some(Selection::new(ty, point, side)); self.terminal.dirty = true; } fn toggle_selection(&mut self, ty: SelectionType, point: Point, side: Side) { - match self.terminal.selection_mut() { + match &mut self.terminal.selection { Some(selection) if selection.ty == ty && !selection.is_empty() => { self.clear_selection(); }, @@ -745,7 +745,7 @@ impl<N: Notify + OnResize> Processor<N> { // Dump grid state. let mut grid = terminal.grid().clone(); - grid.initialize_all(&Cell::default()); + grid.initialize_all(Cell::default()); grid.truncate(); let serialized_grid = json::to_string(&grid).expect("serialize grid"); diff --git a/alacritty/src/input.rs b/alacritty/src/input.rs index 6f1a71aa..01c43ecc 100644 --- a/alacritty/src/input.rs +++ b/alacritty/src/input.rs @@ -117,7 +117,7 @@ impl Action { ctx.toggle_selection(ty, cursor_point, Side::Left); // Make sure initial selection is not empty. - if let Some(selection) = ctx.terminal_mut().selection_mut() { + if let Some(selection) = &mut ctx.terminal_mut().selection { selection.include_all(); } } diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs index 72452a9e..f7c7105c 100644 --- a/alacritty/src/url.rs +++ b/alacritty/src/url.rs @@ -6,7 +6,7 @@ use urlocator::{UrlLocation, UrlLocator}; use font::Metrics; -use alacritty_terminal::index::Point; +use alacritty_terminal::index::{Column, Point}; use alacritty_terminal::term::cell::Flags; use alacritty_terminal::term::color::Rgb; use alacritty_terminal::term::{RenderableCell, RenderableCellContent, SizeInfo}; @@ -19,7 +19,7 @@ use crate::renderer::rects::{RenderLine, RenderRect}; pub struct Url { lines: Vec<RenderLine>, end_offset: u16, - num_cols: usize, + num_cols: Column, } impl Url { @@ -71,8 +71,8 @@ impl Urls { Self::default() } - /// Update tracked URLs. - pub fn update(&mut self, num_cols: usize, cell: RenderableCell) { + // Update tracked URLs. + pub fn update(&mut self, num_cols: Column, cell: RenderableCell) { // Convert cell to character. let c = match cell.inner { RenderableCellContent::Chars(chars) => chars[0], @@ -127,7 +127,7 @@ impl Urls { } // Reset at un-wrapped linebreak. - if cell.column.0 + 1 == num_cols && !cell.flags.contains(Flags::WRAPLINE) { + if cell.column + 1 == num_cols && !cell.flags.contains(Flags::WRAPLINE) { self.reset(); } } @@ -224,7 +224,7 @@ mod tests { let mut urls = Urls::new(); for cell in input { - urls.update(num_cols, cell); + urls.update(Column(num_cols), cell); } let url = urls.urls.first().unwrap(); @@ -240,7 +240,7 @@ mod tests { let mut urls = Urls::new(); for cell in input { - urls.update(num_cols, cell); + urls.update(Column(num_cols), cell); } assert_eq!(urls.urls.len(), 3); diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs index 155b2aa2..100993b2 100644 --- a/alacritty/src/window.rs +++ b/alacritty/src/window.rs @@ -420,7 +420,7 @@ impl Window { /// Adjust the IME editor position according to the new location of the cursor. #[cfg(not(windows))] pub fn update_ime_position<T>(&mut self, terminal: &Term<T>, size_info: &SizeInfo) { - let point = terminal.cursor().point; + let point = terminal.grid().cursor.point; let SizeInfo { cell_width, cell_height, padding_x, padding_y, .. } = size_info; let nspot_x = f64::from(padding_x + point.col.0 as f32 * cell_width); |