From a1e2d6a5573d967aaceeadaefa17b6a00a2e4ca4 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Fri, 1 Jan 2021 05:19:03 +0000 Subject: Add vi/search line indicator This adds a new visual indicator which shows the position in history of either the display offset during search, or the vi mode cursor. To make it as unintrusive as possible, the overlay is hidden whenever the vi mode cursor collides with its position. Fixes #3984. --- alacritty/src/renderer/mod.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'alacritty/src/renderer/mod.rs') diff --git a/alacritty/src/renderer/mod.rs b/alacritty/src/renderer/mod.rs index 5edcbb4a..39e53b82 100644 --- a/alacritty/src/renderer/mod.rs +++ b/alacritty/src/renderer/mod.rs @@ -14,7 +14,7 @@ use fnv::FnvHasher; use log::{error, info}; use unicode_width::UnicodeWidthChar; -use alacritty_terminal::index::{Column, Line}; +use alacritty_terminal::index::Point; use alacritty_terminal::term::cell::Flags; use alacritty_terminal::term::color::Rgb; use alacritty_terminal::term::render::RenderableCell; @@ -820,25 +820,23 @@ impl<'a> RenderApi<'a> { pub fn render_string( &mut self, glyph_cache: &mut GlyphCache, - line: Line, - string: &str, + point: Point, fg: Rgb, - bg: Option, + bg: Rgb, + string: &str, ) { - let bg_alpha = bg.map(|_| 1.0).unwrap_or(0.0); - let cells = string .chars() .enumerate() .map(|(i, character)| RenderableCell { - line, - column: Column(i), + line: point.line, + column: point.col + i, character, zerowidth: None, flags: Flags::empty(), - bg_alpha, + bg_alpha: 1.0, fg, - bg: bg.unwrap_or(Rgb { r: 0, g: 0, b: 0 }), + bg, is_match: false, }) .collect::>(); -- cgit