diff options
author | Elaina Martineau <elainamartineau@gmail.com> | 2019-06-05 18:02:20 -0600 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-06-06 00:02:20 +0000 |
commit | 45565bb9ca9ef33e38cf5e0592d3878e898ed325 (patch) | |
tree | bbf2b3bd3a4e76ff8bd2027f323aa941ef49288f /alacritty_terminal/src/term | |
parent | 3931fb6fbce728c33b4ae2d1e604f181a7246fe0 (diff) | |
download | alacritty-45565bb9ca9ef33e38cf5e0592d3878e898ed325.tar.gz alacritty-45565bb9ca9ef33e38cf5e0592d3878e898ed325.zip |
Re-invert cursor when in selection
Diffstat (limited to 'alacritty_terminal/src/term')
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 38f7f083..629f1cbf 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -420,6 +420,10 @@ impl<'a> Iterator for RenderableCellsIter<'a> { fn next(&mut self) -> Option<Self::Item> { loop { if self.cursor_offset == self.inner.offset() && self.inner.column() == self.cursor.col { + let index = Linear::new(self.grid.num_cols(), self.cursor.col, self.cursor.line); + let selected = + self.selection.as_ref().map(|range| range.contains_(index)).unwrap_or(false); + // Handle cursor if let Some(cursor_key) = self.cursor_key.take() { let cell = Indexed { @@ -427,8 +431,9 @@ impl<'a> Iterator for RenderableCellsIter<'a> { column: self.cursor.col, line: self.cursor.line, }; + let mut renderable_cell = - RenderableCell::new(self.config, self.colors, cell, false); + RenderableCell::new(self.config, self.colors, cell, selected); renderable_cell.inner = RenderableCellContent::Cursor(cursor_key); @@ -439,7 +444,7 @@ impl<'a> Iterator for RenderableCellsIter<'a> { return Some(renderable_cell); } else { let mut cell = - RenderableCell::new(self.config, self.colors, self.inner.next()?, false); + RenderableCell::new(self.config, self.colors, self.inner.next()?, selected); if self.cursor_style == CursorStyle::Block { std::mem::swap(&mut cell.bg, &mut cell.fg); |