font/sprite: add explicit underline cursor

Resolves #7651 - uses cursor thickness rather than underline thickness.
This commit is contained in:
Qwerasd
2025-06-29 16:11:55 -06:00
parent c96af1b3b1
commit 4f9d7c565a
3 changed files with 20 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ pub const Sprite = enum(u32) {
cursor_rect,
cursor_hollow_rect,
cursor_bar,
cursor_underline,
test {
const testing = std.testing;

View File

@@ -326,3 +326,21 @@ pub fn cursor_bar(
.height = @intCast(height),
}, .on);
}
pub fn cursor_underline(
cp: u32,
canvas: *font.sprite.Canvas,
width: u32,
height: u32,
metrics: font.Metrics,
) !void {
_ = cp;
_ = height;
canvas.rect(.{
.x = 0,
.y = @intCast(metrics.underline_position),
.width = @intCast(width),
.height = @intCast(metrics.cursor_thickness),
}, .on);
}

View File

@@ -3098,7 +3098,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,
};