diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2022-03-16 19:27:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-16 19:27:55 +0300 |
commit | f4bdf5fb36fdf3b329be8253da39050abe7238a5 (patch) | |
tree | 9b49a78b15fdd73850a7bfc279e3986af2b59683 /alacritty/src/renderer/rects.rs | |
parent | 589c1e9c6b8830625162af14a9a7aee32c7aade0 (diff) | |
download | r-alacritty-f4bdf5fb36fdf3b329be8253da39050abe7238a5.tar.gz r-alacritty-f4bdf5fb36fdf3b329be8253da39050abe7238a5.tar.bz2 r-alacritty-f4bdf5fb36fdf3b329be8253da39050abe7238a5.zip |
Add colored underline support
This commit adds support for colored underline and refines the dynamic
extra storage. The extra storage now is using `Arc` making cloning it way
faster compared to `Box` approach which scales really well when it comes
to cloning in `Term::write_at_cursor`, since cloning `Arc` is constant
time.
Fixes #4142.
Diffstat (limited to 'alacritty/src/renderer/rects.rs')
-rw-r--r-- | alacritty/src/renderer/rects.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/alacritty/src/renderer/rects.rs b/alacritty/src/renderer/rects.rs index a4a6bf5d..27e306be 100644 --- a/alacritty/src/renderer/rects.rs +++ b/alacritty/src/renderer/rects.rs @@ -193,6 +193,9 @@ impl RenderLines { return; } + // The underline color escape does not apply to strikeout. + let color = if flag.contains(Flags::STRIKEOUT) { cell.fg } else { cell.underline }; + // Include wide char spacer if the current cell is a wide char. let mut end = cell.point; if cell.flags.contains(Flags::WIDE_CHAR) { @@ -201,7 +204,7 @@ impl RenderLines { // Check if there's an active line. if let Some(line) = self.inner.get_mut(&flag).and_then(|lines| lines.last_mut()) { - if cell.fg == line.color + if color == line.color && cell.point.column == line.end.column + 1 && cell.point.line == line.end.line { @@ -212,7 +215,7 @@ impl RenderLines { } // Start new line if there currently is none. - let line = RenderLine { start: cell.point, end, color: cell.fg }; + let line = RenderLine { start: cell.point, end, color }; match self.inner.get_mut(&flag) { Some(lines) => lines.push(line), None => { |