diff options
Diffstat (limited to 'src/Core.zig')
| -rw-r--r-- | src/Core.zig | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/src/Core.zig b/src/Core.zig index eb3f0562..38493b93 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -3682,7 +3682,7 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" defer frame.deinit(); const visible = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; const rect = p.rects[0]; - const body_y = if (p.settings.tag_bottom) rect.y else rect.y + BOX_H; + const body_y = rect.y + BOX_H; try std.testing.expectEqual(rect.x + config.GUTTER + 3, visible.x); try std.testing.expectEqual(body_y, visible.y); @@ -3697,7 +3697,7 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" try std.testing.expectEqual(body_y, modal_cursor.y); tagline.enterTag(p, pane); const tag_cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - try std.testing.expectEqual(if (p.settings.tag_bottom) rect.y + rect.h - BOX_H else rect.y, tag_cursor.y); + try std.testing.expectEqual(rect.y, tag_cursor.y); pane.focus = .body; pane.body.mode = .tty; try std.testing.expect((try p.render(frame.allocator())).cursor == null); @@ -3716,34 +3716,31 @@ test "raw terminal cursor obeys visibility without hiding modal and tag cursors" test "raw terminal cursor follows its active row only while that row is visible" { const gpa = std.testing.allocator; - for ([_]bool{ false, true }) |tag_bottom| { - const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); - defer p.deinit(); - while (p.nextEffect()) |_| {} - p.settings.tag_bottom = tag_bottom; - const pane = p.panes[0].?; - pane.body.mode = .tty; - for (0..60) |_| p.update(.{ .output = .{ .pane = 0, .bytes = "row\r\n" } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[3;4H" } }); - var frame = std.heap.ArenaAllocator.init(gpa); - defer frame.deinit(); - const live = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - const rect = p.rects[0]; - const body_y = if (tag_bottom) rect.y else rect.y + BOX_H; - try std.testing.expectEqual(rect.x + config.GUTTER + 3, live.x); - try std.testing.expectEqual(body_y + 2, live.y); + const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); + defer p.deinit(); + while (p.nextEffect()) |_| {} + const pane = p.panes[0].?; + pane.body.mode = .tty; + for (0..60) |_| p.update(.{ .output = .{ .pane = 0, .bytes = "row\r\n" } }); + p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[3;4H" } }); + var frame = std.heap.ArenaAllocator.init(gpa); + defer frame.deinit(); + const live = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; + const rect = p.rects[0]; + const body_y = rect.y + BOX_H; + try std.testing.expectEqual(rect.x + config.GUTTER + 3, live.x); + try std.testing.expectEqual(body_y + 2, live.y); - pardes.panes.terminal.scrollGrid(pane, -1); - const scrolled = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - try std.testing.expectEqual(live.x, scrolled.x); - try std.testing.expectEqual(live.y + 1, scrolled.y); - pardes.panes.terminal.scrollGrid(pane, -@as(i32, pane.rows)); - try std.testing.expect((try p.render(frame.allocator())).cursor == null); - pardes.panes.terminal.followOutput(pane); - const returned = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; - try std.testing.expectEqual(live.x, returned.x); - try std.testing.expectEqual(live.y, returned.y); - } + pardes.panes.terminal.scrollGrid(pane, -1); + const scrolled = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; + try std.testing.expectEqual(live.x, scrolled.x); + try std.testing.expectEqual(live.y + 1, scrolled.y); + pardes.panes.terminal.scrollGrid(pane, -@as(i32, pane.rows)); + try std.testing.expect((try p.render(frame.allocator())).cursor == null); + pardes.panes.terminal.followOutput(pane); + const returned = (try p.render(frame.allocator())).cursor orelse return error.MissingCursor; + try std.testing.expectEqual(live.x, returned.x); + try std.testing.expectEqual(live.y, returned.y); } test "the bare tty startup opens a text pane under the shell, unfocused" { |
