aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2019-04-22 00:38:59 +0200
committerChristian Duerr <contact@christianduerr.com>2019-04-22 00:53:13 +0200
commit43c8578910e209428cb8a90b4bff9b0ca30541bb (patch)
treeaa7578e501d9cc349eb56c4fd35f53640406c73a
parentd3cfda03715c6a644048995afdffdb085984585a (diff)
downloadalacritty-fix-hidden-cursor.tar.gz
alacritty-fix-hidden-cursor.zip
Fix hidden cursor inverting cell colorsfix-hidden-cursor
Since the block cursor inverts the background and foreground colors of a cell, the hidden cursor has done the same thing without rendering a cursor since it was using the block cursor shape. A new `Hidden` cursor style has been introduced for explicitly handling the invisible cursor differently. This fixes #2342.
-rw-r--r--src/ansi.rs3
-rw-r--r--src/cursor.rs1
-rw-r--r--src/term/mod.rs4
3 files changed, 7 insertions, 1 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index eb8764ac..4e76c05b 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -356,6 +356,9 @@ pub enum CursorStyle {
/// Cursor is a box like `☐`
HollowBlock,
+
+ /// Invisible cursor
+ Hidden,
}
impl Default for CursorStyle {
diff --git a/src/cursor.rs b/src/cursor.rs
index 268f35fa..196241a0 100644
--- a/src/cursor.rs
+++ b/src/cursor.rs
@@ -45,6 +45,7 @@ pub fn get_cursor_glyph(
CursorStyle::Underline => get_underline_cursor_glyph(width, line_width),
CursorStyle::Beam => get_beam_cursor_glyph(height, line_width),
CursorStyle::Block => get_block_cursor_glyph(height, width),
+ CursorStyle::Hidden => RasterizedGlyph::default(),
}
}
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 5f69fb6c..0e95423d 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -175,7 +175,7 @@ impl<'a> RenderableCellsIter<'a> {
term: &'b Term,
config: &'b Config,
selection: Option<Locations>,
- cursor_style: CursorStyle,
+ mut cursor_style: CursorStyle,
metrics: font::Metrics,
) -> RenderableCellsIter<'b> {
let grid = &term.grid;
@@ -236,6 +236,8 @@ impl<'a> RenderableCellsIter<'a> {
&& (cursor.col + 1) < grid.num_cols();
Some(cursor::get_cursor_glyph(cursor_style, metrics, offset_x, offset_y, is_wide))
} else {
+ // Use hidden cursor so text will not get inverted
+ cursor_style = CursorStyle::Hidden;
None
};