diff options
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 2533fbef..9768f2de 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -10330,14 +10330,10 @@ fn cursorBoxes(g: *const Gui, surface: *const pardes.Surface, layout: CellLayout const cursor = layer.cursor orelse continue; if (cursor.x >= layer.cols or cursor.y >= layer.rows) continue; const width: f32 = @floatFromInt(g.tagline_width); - const left = @as(f32, @floatFromInt(layer.viewport.x)) * layout.w; - const right = left + @as(f32, @floatFromInt(layer.viewport.w)) * layout.w; - // Past a full row's end the caret sits at the tag's right edge, as - // the grid's does (and the core's cursor box, draw.focusedCursorBox). - const x = @min(left + @as(f32, @floatFromInt(cursor.x)) * width, right - if (cursor.bar) @max(dp(1), width / 8) else width); + const span = layer.caretSpan(cursor.x, layout.w, width, if (cursor.bar) @max(dp(1), width / 8) else width); const y = layer.viewport.y + cursor.y; const top = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, win_h, g.cell_h, g.tagline_height))); - out[n] = .{ .x0 = x, .y0 = top, .x1 = @min(right, x + if (cursor.bar) @max(dp(1), width / 8) else width), .y1 = top + @as(f32, @floatFromInt(g.tagline_height)), .rgb = cursorColor(chrome, &layer.cells[@as(usize, cursor.y) * layer.cols + cursor.x], .tagline), .text = page, .bar = cursor.bar }; + out[n] = .{ .x0 = span[0], .y0 = top, .x1 = span[1], .y1 = top + @as(f32, @floatFromInt(g.tagline_height)), .rgb = cursorColor(chrome, &layer.cells[@as(usize, cursor.y) * layer.cols + cursor.x], .tagline), .text = page, .bar = cursor.bar }; n += 1; } return n; |
