mirror of
https://github.com/alacritty/alacritty.git
synced 2025-02-10 15:46:10 -05:00
Re-invert cursor when in selection
This commit is contained in:
parent
3931fb6fbc
commit
45565bb9ca
2 changed files with 8 additions and 2 deletions
|
@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Cells with identical foreground and background will now show their text upon selection/inversion
|
||||
- Default Window padding to 0x0
|
||||
- Moved config option `render_timer` and `persistent_logging` to the `debug` group
|
||||
- When the cursor is in the selection, it will be inverted again, making it visible
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue