diff options
Diffstat (limited to 'src/draw.zig')
| -rw-r--r-- | src/draw.zig | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/draw.zig b/src/draw.zig index 2fabff06..a73613ac 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -4,6 +4,7 @@ //! chips, the workspace and column tags, the tag layers, drag overlays, the //! debug box, then the cursor. const std = @import("std"); +const vaxis = @import("vaxis"); const pardes = @import("pardes.zig"); const layout = @import("layout.zig"); const config = @import("config.zig"); @@ -58,7 +59,7 @@ pub fn place(p: *Pardes, s: *Surface) void { // A folded pane is its tag rows and nothing else. if (pane.collapsed) continue; const body_h = r.h -| pane.tag_rows; - const line: i32 = if (pane.file) |f| @intCast(@min(f.scroll, std.math.maxInt(i32))) else if (pane.isTerminal()) panes.terminal.gridOffset(pane) else 0; + const line: i32 = if (pane.file) |f| @intCast(@min(f.scroll, std.math.maxInt(i32))) else if (pane.isTerminal()) @intCast(panes.Term.grid(pane.terminal).offset) else 0; // The text it shows, for a frontend's glide to tell apart: a file's // path, a generated text's revision with it (rows rewritten as its // view moved are another text's); none for a terminal or a picture. @@ -73,8 +74,8 @@ pub fn place(p: *Pardes, s: *Surface) void { .offset = f.scroll, .len = pane.rows, } else blk: { - const gsb = panes.terminal.scrollbar(pane); - break :blk .{ .total = gsb.total, .offset = gsb.offset, .len = gsb.len }; + const grid = panes.Term.grid(pane.terminal); + break :blk .{ .total = grid.total, .offset = grid.offset, .len = grid.len }; }; const track_h: usize = body_h; const total = if (sb.total == 0) 1 else sb.total; @@ -239,8 +240,8 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { const v = p.view(); const taped = pardes.tape.enter(p, .render); defer pardes.tape.leave(p, taped); - panes.terminal.drawing = true; - defer panes.terminal.drawing = false; + edit.drawing = true; + defer edit.drawing = false; panes.File.refreshHighlights(p); const s = &p.surface; const ncells = @as(usize, v.screen_w) * v.screen_h; @@ -322,9 +323,9 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { sb_off = 0; sb_total = 0; } else { - const sb = panes.terminal.scrollbar(at); - sb_off = sb.offset; - sb_total = sb.total; + const grid = panes.Term.grid(at.terminal); + sb_off = grid.offset; + sb_total = grid.total; } const effective_font = p.settings.font.effective_name.get(); const font_name = if (effective_font.len == 0) "default" else effective_font; @@ -1236,7 +1237,7 @@ test "a wide glyph cut by a tag's or a notice's edge is joined into the grid as const head = !cell.default and cell.len > 1 and i + 1 < row.len and !row[i + 1].default and row[i + 1].len == 0; // A spacer has its head before it; a head its spacer after. if (spacer) try std.testing.expect(i > 0 and row[i - 1].len > 1); - if (i + 1 == row.len) try std.testing.expect(!head and !(cell.len > 1 and panes.File.utf8Width(cell.grapheme()) == 2)); + if (i + 1 == row.len) try std.testing.expect(!head and !(cell.len > 1 and vaxis.gwidth.gwidth(cell.grapheme(), .unicode) == 2)); } // The right edge of each is the band, blank where a glyph was cut. try std.testing.expectEqual(FontRole.tagline, row[row.len - 1].style.font_role); |
