diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2020-12-28 12:45:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-28 09:45:39 +0000 |
commit | 12fbd0051cd743bcea79f45777325f76485fd865 (patch) | |
tree | 8e09bf529451b21bfffaa27ed42116338837216c /alacritty/src/url.rs | |
parent | fdc10d270e423e6bec756cab61b502e28260129e (diff) | |
download | r-alacritty-12fbd0051cd743bcea79f45777325f76485fd865.tar.gz r-alacritty-12fbd0051cd743bcea79f45777325f76485fd865.tar.bz2 r-alacritty-12fbd0051cd743bcea79f45777325f76485fd865.zip |
Draw cursor with rect renderer
This commit makes cursors being drawn via rects, thus it's always above
underlines/strikeouts. Also, since the cursor isn't a glyph anymore, it
can't be obscured due to atlas switching while glyphs are rendered.
Fixes #4404.
Fixes #3471.
Diffstat (limited to 'alacritty/src/url.rs')
-rw-r--r-- | alacritty/src/url.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/alacritty/src/url.rs b/alacritty/src/url.rs index b33b532e..f4bf8205 100644 --- a/alacritty/src/url.rs +++ b/alacritty/src/url.rs @@ -8,7 +8,8 @@ use urlocator::{UrlLocation, UrlLocator}; use alacritty_terminal::index::{Column, Point}; use alacritty_terminal::term::cell::Flags; use alacritty_terminal::term::color::Rgb; -use alacritty_terminal::term::{RenderableCell, RenderableCellContent, SizeInfo}; +use alacritty_terminal::term::render::RenderableCell; +use alacritty_terminal::term::SizeInfo; use crate::config::Config; use crate::event::Mouse; @@ -72,12 +73,6 @@ impl Urls { // Update tracked URLs. pub fn update(&mut self, num_cols: Column, cell: &RenderableCell) { - // Convert cell to character. - let c = match &cell.inner { - RenderableCellContent::Chars((c, _zerowidth)) => *c, - RenderableCellContent::Cursor(_) => return, - }; - let point: Point = cell.into(); let mut end = point; @@ -107,7 +102,7 @@ impl Urls { } // Advance parser. - let last_state = mem::replace(&mut self.state, self.locator.advance(c)); + let last_state = mem::replace(&mut self.state, self.locator.advance(cell.character)); match (self.state, last_state) { (UrlLocation::Url(_length, end_offset), UrlLocation::Scheme) => { // Create empty URL. @@ -204,8 +199,9 @@ mod tests { fn text_to_cells(text: &str) -> Vec<RenderableCell> { text.chars() .enumerate() - .map(|(i, c)| RenderableCell { - inner: RenderableCellContent::Chars((c, None)), + .map(|(i, character)| RenderableCell { + character, + zerowidth: None, line: Line(0), column: Column(i), fg: Default::default(), |