summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-09-27 03:51:58 +0000
committerGitHub <noreply@github.com>2021-09-27 03:51:58 +0000
commitb6e05d2dceb80536b54c8ca4085e22075e4527a1 (patch)
tree192589a281769b57d1387c0919fd035366ef0a82
parent58985a4dcbe464230b5d2566ee68e2d34a1788c8 (diff)
Fix vi indicator obstructing vi mode cursor
Fixes #5504.
-rw-r--r--CHANGELOG.md4
-rw-r--r--alacritty/src/display/mod.rs9
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1694f367..e5be002d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Config option `background_opacity`, you should use `window.opacity` instead
- Reload configuration files when their symbolic link is replaced
+### Fixed
+
+- Line indicator obstructing vi mode cursor when scrolled into history
+
## 0.9.0
### Packaging
diff --git a/alacritty/src/display/mod.rs b/alacritty/src/display/mod.rs
index d4c5c274..946c27f9 100644
--- a/alacritty/src/display/mod.rs
+++ b/alacritty/src/display/mod.rs
@@ -544,7 +544,10 @@ impl Display {
// Indicate vi mode by showing the cursor's position in the top right corner.
let vi_point = vi_mode_cursor.point;
let line = (-vi_point.line.0 + size_info.bottommost_line().0) as usize;
- self.draw_line_indicator(config, &size_info, total_lines, Some(vi_point), line);
+ let obstructed_column = Some(vi_point)
+ .filter(|point| point.line == -(display_offset as i32))
+ .map(|point| point.column);
+ self.draw_line_indicator(config, &size_info, total_lines, obstructed_column, line);
} else if search_state.regex().is_some() {
// Show current display offset in vi-less search to indicate match position.
self.draw_line_indicator(config, &size_info, total_lines, None, display_offset);
@@ -777,7 +780,7 @@ impl Display {
config: &Config,
size_info: &SizeInfo,
total_lines: usize,
- vi_mode_point: Option<Point>,
+ obstructed_column: Option<Column>,
line: usize,
) {
let text = format!("[{}/{}]", line, total_lines - 1);
@@ -787,7 +790,7 @@ impl Display {
let bg = colors.line_indicator.background.unwrap_or(colors.primary.foreground);
// Do not render anything if it would obscure the vi mode cursor.
- if vi_mode_point.map_or(true, |point| point.line != 0 || point.column < column) {
+ if obstructed_column.map_or(true, |obstructed_column| obstructed_column < column) {
let glyph_cache = &mut self.glyph_cache;
self.renderer.with_api(&config.ui_config, size_info, |mut api| {
api.render_string(glyph_cache, Point::new(0, column), fg, bg, &text);