Add support for adjusting thickness of underline cursor

Signed-off-by: Aaron Ruan <i@ar212.com>
This commit is contained in:
Aaron Ruan
2025-06-25 22:50:08 +08:00
parent 74a03ebd6e
commit 7d078590b9
4 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,7 @@ pub const Sprite = enum(u32) {
cursor_rect,
cursor_hollow_rect,
cursor_bar,
cursor_underline,
// Note: we don't currently put the box drawing glyphs in here because
// there are a LOT and I'm lazy. What I want to do is spend more time

View File

@ -174,6 +174,7 @@ const Kind = enum {
.cursor_rect,
.cursor_hollow_rect,
.cursor_bar,
.cursor_underline,
=> .cursor,
},

View File

@ -43,6 +43,12 @@ pub fn renderGlyph(
.width = thickness,
.height = height,
}, .on),
Sprite.cursor_underline => canvas.rect(.{
.x = 0,
.y = height -| thickness,
.width = width,
.height = thickness,
}, .on),
else => unreachable,
}

View File

@ -2868,7 +2868,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
.block => .cursor_rect,
.block_hollow => .cursor_hollow_rect,
.bar => .cursor_bar,
.underline => .underline,
.underline => .cursor_underline,
.lock => unreachable,
};