diff options
Diffstat (limited to 'src/terminal.zig')
| -rw-r--r-- | src/terminal.zig | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/terminal.zig b/src/terminal.zig index c9c60b5b..8204b0af 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -544,7 +544,7 @@ pub fn visibleCursor(pane: *const Pane) ?GridCursor { /// many as keep its cursor's row in sight, as tmux pans a bigger window in /// a smaller client. 0 in the view that sizes it, and in one tall enough. pub fn panFor(p: *const Pardes, pane: *const Pane, r: pardes.Rect) u16 { - if (pane.sized_by == p.view or pane.collapsed or !pane.isTerminal()) return 0; + if (pane.sized_by == p.live or pane.collapsed or !pane.isTerminal()) return 0; const shown = r.h -| pane.tag_rows; if (shown == 0 or shown >= pane.rows) return 0; const state = pane.terminal orelse return 0; @@ -2642,7 +2642,7 @@ test "terminal Filter keys indexed truecolor OSC and background-only cells throu var frame = std.heap.ArenaAllocator.init(testing.allocator); defer frame.deinit(); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); @@ -2783,7 +2783,7 @@ test "terminal Filter preserves exact palette-null light theme default roles" { var frame = std.heap.ArenaAllocator.init(testing.allocator); defer frame.deinit(); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); const ordinary = try p.render(frame.allocator()); @@ -2842,7 +2842,7 @@ test "terminal Filter refuses a foreground that would collapse onto the page" { var frame = std.heap.ArenaAllocator.init(testing.allocator); defer frame.deinit(); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); @@ -2934,7 +2934,7 @@ test "tty ansi colors follow the prompt hug into normal mode" { var frame = std.heap.ArenaAllocator.init(testing.allocator); defer frame.deinit(); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); const red: pardes.Color = .{ .rgb = p.theme().palette.?[1] }; @@ -2971,7 +2971,7 @@ test "a prompt row hidden end to end paints nothing at all" { var frame = std.heap.ArenaAllocator.init(testing.allocator); defer frame.deinit(); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const body_y = p.bodyTop(pane, r); p.shell_rows.stale = true; @@ -3060,8 +3060,8 @@ fn syncPixels(p: *const Pardes, pane: *Pane) void { if (comptime !images_enabled) return; const state = pane.terminal orelse return; const vt = &state.vt; - vt.width_px = @as(u32, vt.cols) * p.cell_pixels.w; - vt.height_px = @as(u32, vt.rows) * p.cell_pixels.h; + vt.width_px = @as(u32, vt.cols) * p.view().cell_pixels.w; + vt.height_px = @as(u32, vt.rows) * p.view().cell_pixels.h; } /// When the pane's next kitty animation frame is due (ms on the core's @@ -3153,7 +3153,7 @@ test "a program that asked for focus reports hears CSI I and CSI O as its pane t var out: std.ArrayList(u8) = .empty; defer out.deinit(gpa); _ = try ptyWritesByPane(p, &out); - p.active = 0; + p.view().active = 0; // Asking while its pane has the keyboard: told at once that it has. p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?1004h" } }); try std.testing.expectEqualStrings("0:\x1b[I\n", try ptyWritesByPane(p, &out)); @@ -3161,12 +3161,12 @@ test "a program that asked for focus reports hears CSI I and CSI O as its pane t try std.testing.expectEqualStrings("", try ptyWritesByPane(p, &out)); // A click into the other pane moves the keyboard: out of one, into the // other. - const r = p.rects[1]; + const r = p.view().rects[1]; const at_col = r.x + config.GUTTER + 2; const at_row = p.bodyTop(p.panes[1].?, r) + 1; p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = at_col, .row = at_row } }); p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = at_col, .row = at_row } }); - try std.testing.expectEqual(@as(usize, 1), p.active); + try std.testing.expectEqual(@as(usize, 1), p.view().active); try std.testing.expectEqualStrings("0:\x1b[O\n1:\x1b[I\n", try ptyWritesByPane(p, &out)); // The window: away and back. p.update(.{ .focus = false }); @@ -3176,7 +3176,7 @@ test "a program that asked for focus reports hears CSI I and CSI O as its pane t p.update(.{ .focus = true }); try std.testing.expectEqualStrings("1:\x1b[I\n", try ptyWritesByPane(p, &out)); // A program that did not ask hears nothing: pane 2. - p.active = 2; + p.view().active = 2; p.update(.tick); try std.testing.expectEqualStrings("1:\x1b[O\n", try ptyWritesByPane(p, &out)); } @@ -3203,8 +3203,8 @@ test "a terminal's kitty graphics image is drawn where its program placed it, an const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 }); defer p.deinit(); - p.frontend.native_images = true; - p.active = 0; + p.view().frontend.native_images = true; + p.view().active = 0; p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } }); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); @@ -3215,7 +3215,7 @@ test "a terminal's kitty graphics image is drawn where its program placed it, an const places = imagePlaces(s); try std.testing.expectEqual(@as(usize, 1), places.len); const place = places[0]; - const r = p.rects[0]; + const r = p.view().rects[0]; const img = pane.terminal.?.vt.screens.active.kitty_images.imageById(7).?; try std.testing.expectEqual(pardes.Placement.keyOf(pane.serial, 7, @truncate(img.generation)), place.key); try std.testing.expectEqual(pardes.RectCell{ .x = r.x + config.GUTTER + 4, .y = p.bodyTop(pane, r) + 2, .w = 2, .h = 1 }, place.dst); @@ -3257,7 +3257,7 @@ test "ED 3 takes away a kitty placement whose row it erased: it never comes back const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 }); defer p.deinit(); - p.frontend.native_images = true; + p.view().frontend.native_images = true; p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } }); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); @@ -3324,7 +3324,7 @@ test "a virtual kitty placement shows through its placeholder cells, which draw const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 }); defer p.deinit(); - p.frontend.native_images = true; + p.view().frontend.native_images = true; p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } }); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); @@ -3338,7 +3338,7 @@ test "a virtual kitty placement shows through its placeholder cells, which draw const s = try p.render(frame.allocator()); const places = imagePlaces(s); try std.testing.expectEqual(@as(usize, 1), places.len); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const y = p.bodyTop(pane, r) + 1; try std.testing.expectEqual(pardes.RectCell{ .x = tx + 2, .y = y, .w = 2, .h = 1 }, places[0].dst); @@ -3358,13 +3358,13 @@ test "a terminal's image is a placement whatever the frontend draws, and the Pet const pane = p.panes[0].?; pane.body.mode = .tty; p.update(.{ .output = .{ .pane = 0, .bytes = kittyTransmit("c=2,r=1") } }); - const r = p.rects[0]; + const r = p.view().rects[0]; const tx = r.x + config.GUTTER; const y = p.bodyTop(pane, r); // A frontend that draws no pixels (a tty under no kitty graphics) is // handed the picture all the same, and the cells under it are its. - p.frontend.native_images = false; + p.view().frontend.native_images = false; var s = try p.render(frame.allocator()); try std.testing.expectEqual(@as(usize, 1), imagePlaces(s).len); try std.testing.expect(!imagePlaces(s)[0].art.glyph); @@ -3374,7 +3374,7 @@ test "a terminal's image is a placement whatever the frontend draws, and the Pet try std.testing.expect(std.mem.indexOf(u8, try tagline.tagPrefix(p, pane), " petscii:on") != null); // The builtin flips the pane to glyph art and back. - p.frontend.native_images = true; + p.view().frontend.native_images = true; try std.testing.expect(p.executeBuiltinLine(0, "Petscii")); _ = frame.reset(.retain_capacity); s = try p.render(frame.allocator()); |
