mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-20 10:46:07 +03:00
renderer: render cursor over wide character if on tail part
This commit is contained in:
@ -1397,12 +1397,26 @@ fn addCursor(
|
|||||||
screen: *terminal.Screen,
|
screen: *terminal.Screen,
|
||||||
cursor_style: renderer.CursorStyle,
|
cursor_style: renderer.CursorStyle,
|
||||||
) ?*const mtl_shaders.Cell {
|
) ?*const mtl_shaders.Cell {
|
||||||
// Add the cursor
|
// Add the cursor. We render the cursor over the wide character if
|
||||||
const cell = screen.getCell(
|
// we're on the wide characer tail.
|
||||||
.active,
|
const cell, const x = cell: {
|
||||||
screen.cursor.y,
|
// The cursor goes over the screen cursor position.
|
||||||
screen.cursor.x,
|
const cell = screen.getCell(
|
||||||
);
|
.active,
|
||||||
|
screen.cursor.y,
|
||||||
|
screen.cursor.x,
|
||||||
|
);
|
||||||
|
if (!cell.attrs.wide_spacer_tail or screen.cursor.x == 0)
|
||||||
|
break :cell .{ cell, screen.cursor.x };
|
||||||
|
|
||||||
|
// If we're part of a wide character, we move the cursor back to
|
||||||
|
// the actual character.
|
||||||
|
break :cell .{ screen.getCell(
|
||||||
|
.active,
|
||||||
|
screen.cursor.y,
|
||||||
|
screen.cursor.x - 1,
|
||||||
|
), screen.cursor.x - 1 };
|
||||||
|
};
|
||||||
|
|
||||||
const color = self.config.cursor_color orelse terminal.color.RGB{
|
const color = self.config.cursor_color orelse terminal.color.RGB{
|
||||||
.r = 0xFF,
|
.r = 0xFF,
|
||||||
@ -1430,7 +1444,7 @@ fn addCursor(
|
|||||||
self.cells.appendAssumeCapacity(.{
|
self.cells.appendAssumeCapacity(.{
|
||||||
.mode = .fg,
|
.mode = .fg,
|
||||||
.grid_pos = .{
|
.grid_pos = .{
|
||||||
@as(f32, @floatFromInt(screen.cursor.x)),
|
@as(f32, @floatFromInt(x)),
|
||||||
@as(f32, @floatFromInt(screen.cursor.y)),
|
@as(f32, @floatFromInt(screen.cursor.y)),
|
||||||
},
|
},
|
||||||
.cell_width = if (cell.attrs.wide) 2 else 1,
|
.cell_width = if (cell.attrs.wide) 2 else 1,
|
||||||
|
@ -848,12 +848,26 @@ fn addCursor(
|
|||||||
screen: *terminal.Screen,
|
screen: *terminal.Screen,
|
||||||
cursor_style: renderer.CursorStyle,
|
cursor_style: renderer.CursorStyle,
|
||||||
) ?*const GPUCell {
|
) ?*const GPUCell {
|
||||||
// Add the cursor
|
// Add the cursor. We render the cursor over the wide character if
|
||||||
const cell = screen.getCell(
|
// we're on the wide characer tail.
|
||||||
.active,
|
const cell, const x = cell: {
|
||||||
screen.cursor.y,
|
// The cursor goes over the screen cursor position.
|
||||||
screen.cursor.x,
|
const cell = screen.getCell(
|
||||||
);
|
.active,
|
||||||
|
screen.cursor.y,
|
||||||
|
screen.cursor.x,
|
||||||
|
);
|
||||||
|
if (!cell.attrs.wide_spacer_tail or screen.cursor.x == 0)
|
||||||
|
break :cell .{ cell, screen.cursor.x };
|
||||||
|
|
||||||
|
// If we're part of a wide character, we move the cursor back to
|
||||||
|
// the actual character.
|
||||||
|
break :cell .{ screen.getCell(
|
||||||
|
.active,
|
||||||
|
screen.cursor.y,
|
||||||
|
screen.cursor.x - 1,
|
||||||
|
), screen.cursor.x - 1 };
|
||||||
|
};
|
||||||
|
|
||||||
const color = self.config.cursor_color orelse terminal.color.RGB{
|
const color = self.config.cursor_color orelse terminal.color.RGB{
|
||||||
.r = 0xFF,
|
.r = 0xFF,
|
||||||
@ -880,7 +894,7 @@ fn addCursor(
|
|||||||
|
|
||||||
self.cells.appendAssumeCapacity(.{
|
self.cells.appendAssumeCapacity(.{
|
||||||
.mode = .fg,
|
.mode = .fg,
|
||||||
.grid_col = @intCast(screen.cursor.x),
|
.grid_col = @intCast(x),
|
||||||
.grid_row = @intCast(screen.cursor.y),
|
.grid_row = @intCast(screen.cursor.y),
|
||||||
.grid_width = if (cell.attrs.wide) 2 else 1,
|
.grid_width = if (cell.attrs.wide) 2 else 1,
|
||||||
.fg_r = color.r,
|
.fg_r = color.r,
|
||||||
|
Reference in New Issue
Block a user