aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/cursor.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-12-24 01:28:41 +0300
committerGitHub <noreply@github.com>2020-12-23 22:28:41 +0000
commitfdc10d270e423e6bec756cab61b502e28260129e (patch)
treecb55f8cfb7776d861d50b7b3e5b2d165d3f38ce7 /alacritty/src/cursor.rs
parentf19cbca9b4c98a33b786bd971e3abae66bd16e26 (diff)
downloadr-alacritty-fdc10d270e423e6bec756cab61b502e28260129e.tar.gz
r-alacritty-fdc10d270e423e6bec756cab61b502e28260129e.tar.bz2
r-alacritty-fdc10d270e423e6bec756cab61b502e28260129e.zip
Hide "missing" glyp for zerowidth character
This patch prevents missing zerowidth glyphs from obscuring the rendered glyph of a cell. The missing glyph itself is also consistently loaded and displayed on all platforms. It is initialized once together with the ascii symbols and then written to the atlas only once for every cached missing glyph. Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src/cursor.rs')
-rw-r--r--alacritty/src/cursor.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/alacritty/src/cursor.rs b/alacritty/src/cursor.rs
index 94808029..806f6ff8 100644
--- a/alacritty/src/cursor.rs
+++ b/alacritty/src/cursor.rs
@@ -37,39 +37,39 @@ pub fn get_cursor_glyph(
/// Return a custom underline cursor character.
pub fn get_underline_cursor_glyph(width: usize, line_width: usize) -> RasterizedGlyph {
// Create a new rectangle, the height is relative to the font width.
- let buf = vec![255u8; width * line_width * 3];
+ let buffer = BitmapBuffer::RGB(vec![255u8; width * line_width * 3]);
// Create a custom glyph with the rectangle data attached to it.
RasterizedGlyph {
- c: ' ',
+ character: ' ',
top: line_width as i32,
left: 0,
height: line_width as i32,
width: width as i32,
- buf: BitmapBuffer::RGB(buf),
+ buffer,
}
}
/// Return a custom beam cursor character.
pub fn get_beam_cursor_glyph(height: usize, line_width: usize) -> RasterizedGlyph {
// Create a new rectangle that is at least one pixel wide
- let buf = vec![255u8; line_width * height * 3];
+ let buffer = BitmapBuffer::RGB(vec![255u8; line_width * height * 3]);
// Create a custom glyph with the rectangle data attached to it
RasterizedGlyph {
- c: ' ',
+ character: ' ',
top: height as i32,
left: 0,
height: height as i32,
width: line_width as i32,
- buf: BitmapBuffer::RGB(buf),
+ buffer,
}
}
/// Returns a custom box cursor character.
pub fn get_box_cursor_glyph(height: usize, width: usize, line_width: usize) -> RasterizedGlyph {
// Create a new box outline rectangle.
- let mut buf = Vec::with_capacity(width * height * 3);
+ let mut buffer = Vec::with_capacity(width * height * 3);
for y in 0..height {
for x in 0..width {
if y < line_width
@@ -77,36 +77,36 @@ pub fn get_box_cursor_glyph(height: usize, width: usize, line_width: usize) -> R
|| x < line_width
|| x >= width - line_width
{
- buf.append(&mut vec![255u8; 3]);
+ buffer.append(&mut vec![255u8; 3]);
} else {
- buf.append(&mut vec![0u8; 3]);
+ buffer.append(&mut vec![0u8; 3]);
}
}
}
// Create a custom glyph with the rectangle data attached to it.
RasterizedGlyph {
- c: ' ',
+ character: ' ',
top: height as i32,
left: 0,
height: height as i32,
width: width as i32,
- buf: BitmapBuffer::RGB(buf),
+ buffer: BitmapBuffer::RGB(buffer),
}
}
/// Return a custom block cursor character.
pub fn get_block_cursor_glyph(height: usize, width: usize) -> RasterizedGlyph {
// Create a completely filled glyph.
- let buf = vec![255u8; width * height * 3];
+ let buffer = BitmapBuffer::RGB(vec![255u8; width * height * 3]);
// Create a custom glyph with the rectangle data attached to it.
RasterizedGlyph {
- c: ' ',
+ character: ' ',
top: height as i32,
left: 0,
height: height as i32,
width: width as i32,
- buf: BitmapBuffer::RGB(buf),
+ buffer,
}
}