mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-05 19:08:17 +00:00
font/sprite: add explicit underline cursor
Resolves #7651 - uses cursor thickness rather than underline thickness.
This commit is contained in:
@@ -32,6 +32,7 @@ pub const Sprite = enum(u32) {
|
||||
cursor_rect,
|
||||
cursor_hollow_rect,
|
||||
cursor_bar,
|
||||
cursor_underline,
|
||||
|
||||
test {
|
||||
const testing = std.testing;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user