summaryrefslogtreecommitdiff
path: root/test/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/panes.zig')
-rw-r--r--test/panes.zig26
1 files changed, 11 insertions, 15 deletions
diff --git a/test/panes.zig b/test/panes.zig
index 69628cd9..8e71e69d 100644
--- a/test/panes.zig
+++ b/test/panes.zig
@@ -468,7 +468,7 @@ const TreeContextTests = struct {
try std.testing.expectEqual(@as(i32, 59), pane.wrapAt(visible.row).line);
const cursor = surface.cursor orelse return error.MissingLookCursor;
const rect = p.rects[0];
- const y = p.bodyTop(pane, rect);
+ const y = p.bodyTop(rect);
try std.testing.expectEqual(y + @as(u16, @intCast(visible.row)), cursor.y);
}
}
@@ -490,7 +490,7 @@ const TreeContextTests = struct {
try std.testing.expectEqual(@as(i32, 7), pane.wrapAt(pane.context_rows).line);
const rect = p.rects[0];
const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane);
- const y = p.bodyTop(pane, rect);
+ const y = p.bodyTop(rect);
ClickCursorTests.click(p, .left, x + 6, y);
try std.testing.expectEqual(@as(i32, 0), pane.cur_row);
try std.testing.expectEqual(@as(i32, 6), pane.cur_col);
@@ -499,7 +499,7 @@ const TreeContextTests = struct {
try std.testing.expectEqual(x + 6, cursor.x);
// Read the body top again: the click cleared the announcement band the
// builtin above put up, and the body moved back up with it.
- try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y);
+ try std.testing.expectEqual(p.bodyTop(p.rects[0]), cursor.y);
p.update(.{ .key = .{ .cp = 'i' } });
p.update(.{ .key = .{ .cp = 'Z', .text = "Z" } });
try std.testing.expect(std.mem.startsWith(u8, pane.file.?.content, "const ZBox = struct {"));
@@ -538,7 +538,7 @@ const TreeContextTests = struct {
const surface = try p.render(frame.allocator());
try std.testing.expectEqual(@as(u16, 3), pane.context_rows);
const rect = p.rects[0];
- const y = p.bodyTop(pane, rect);
+ const y = p.bodyTop(rect);
var glyph_x: ?u16 = null;
for (0..surface.cols) |col| {
if (std.mem.eql(u8, surface.at(@intCast(col), y).grapheme(), "界")) glyph_x = @intCast(col);
@@ -552,7 +552,7 @@ const TreeContextTests = struct {
try std.testing.expectEqual(x, cursor.x);
// Read the body top again: the click cleared the announcement band the
// builtin above put up, so the body moved with it.
- try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y);
+ try std.testing.expectEqual(p.bodyTop(p.rects[0]), cursor.y);
panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, "// no enclosing declaration\n" ** 18));
_ = try p.render(frame.allocator());
try std.testing.expectEqual(@as(u16, 0), pane.context_rows);
@@ -580,16 +580,12 @@ const TreeContextTests = struct {
target = .{ .x = @intCast(col), .y = @intCast(row) };
};
const glyph = target orelse return error.MissingWrappedContextBody;
- const offset = pane.body_offset;
ClickCursorTests.click(p, .left, glyph.x + 1, glyph.y);
try std.testing.expectEqual(@as(i32, 2), pane.cur_row);
try std.testing.expectEqual(@as(i32, @intCast(std.mem.indexOf(u8, body, "界").?)), pane.cur_col);
const cursor = (try p.render(frame.allocator())).cursor orelse return error.MissingContextBodyCursor;
try std.testing.expectEqual(glyph.x, cursor.x);
- // The scan above ran with the builtin's announcement band up; the click
- // cleared it, so the row the glyph was found on has moved up with the
- // body it belongs to.
- try std.testing.expectEqual(glyph.y - offset, cursor.y);
+ try std.testing.expectEqual(glyph.y, cursor.y);
}
};
@@ -615,7 +611,7 @@ const TtySelectionTests = struct {
_ = try p.render(frame.allocator());
const rect = p.rects[0];
const x = rect.x + config.GUTTER;
- const y = p.bodyTop(pane, rect);
+ const y = p.bodyTop(rect);
JumpSelectionTests.drag(p, x + 1, y, x + 3, y);
try std.testing.expectEqualStrings("lph", p.yank orelse return error.MissingAutomaticTtyYank);
p.update(.{ .key = .{ .cp = p.opts.tty_toggle, .ctrl = true } });
@@ -645,7 +641,7 @@ const TtySelectionTests = struct {
_ = try p.render(frame.allocator());
const rect = p.rects[0];
const x = rect.x + config.GUTTER;
- const y = p.bodyTop(pane, rect);
+ const y = p.bodyTop(rect);
JumpSelectionTests.drag(p, x + @as(u16, if (prompt) 0 else 1), y, x + 3, y + @as(u16, if (prompt) 0 else 1));
const expected = if (prompt) "$ ab" else "lph\nrav";
try std.testing.expectEqual(Pane.Mode.tty, pane.mode);
@@ -960,7 +956,7 @@ const JumpSelectionTests = struct {
if (wrap) try std.testing.expectEqual(pane.wrap_line[0], pane.wrap_line[1]);
const rect = p.rects[0];
const x = rect.x + config.GUTTER + panes.File.gutterWidth(pane);
- const y = p.bodyTop(pane, rect);
+ const y = p.bodyTop(rect);
if (reverse)
drag(p, x + last_col, y + 1, x + first_col, y)
else
@@ -991,7 +987,7 @@ const JumpSelectionTests = struct {
// A selection created after Back must also disappear on Forward.
// Back announces itself, so the body sits under a notice band now.
- const y2 = p.bodyTop(pane, p.rects[0]);
+ const y2 = p.bodyTop(p.rects[0]);
drag(p, x + 1, y2, x + 3, y2 + 1);
try std.testing.expect(pardes.test_api.heldSelection(p, 0) != null);
p.update(.{ .key = .{ .cp = 'i', .ctrl = true } });
@@ -4127,7 +4123,7 @@ test "cancelled normal gestures leave no count or subprefix after mouse and focu
.body, .tag => {
const rect = p.rects[0];
const tag_y = if (p.settings.tag_bottom) rect.y + rect.h - pardes.BOX_H else rect.y;
- const body_y = p.bodyTop(pane, rect);
+ const body_y = p.bodyTop(rect);
const x = rect.x + config.GUTTER + @as(u16, @intCast(panes.File.gutterWidth(pane))) + 3;
const y = if (gesture == .tag) tag_y else body_y;
p.update(.{ .mouse = .{ .button = config.select_button, .kind = .press, .col = x, .row = y } });