summaryrefslogtreecommitdiff
path: root/src/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core.zig')
-rw-r--r--src/Core.zig23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/Core.zig b/src/Core.zig
index 38493b93..a455cf1c 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -1777,7 +1777,7 @@ pub fn sync(p: *Pardes) void {
// The session's part of the pane's view geometry (File.geometry),
// and its context declarations.
if (pane.file) |*f| pardes.panes.File.refreshContext(p, pane, f);
- pane.view = .{ .wrap = p.settings.wrap, .layered = p.settings.tree_context_tag_style, .body_h = p.row_metrics.body_h, .tagline_h = p.row_metrics.tagline_h, .rect_h = r.h };
+ pane.view = .{ .wrap = p.settings.wrap, .body_h = p.row_metrics.body_h, .tagline_h = p.row_metrics.tagline_h, .rect_h = r.h };
// The tag takes a row per line, leaving the body one row if it
// had any; a folded pane shows its first line only. Its prefix
// is made once, on the stack: this runs on every event, and not
@@ -2366,7 +2366,7 @@ test "LocationsConfig command reports partial updates and survives restore" {
try std.testing.expectEqual(expected, restored.locations_config);
}
-test "TreeContext tag style preserves message rows and its opt-out survives restore" {
+test "TreeContext rows in the tag style keep the message rows" {
if (comptime !syntax.enabled) return error.SkipZigTest;
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 });
defer p.deinit();
@@ -2380,7 +2380,6 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest
pane.msg_len = 0;
p.sync();
_ = try p.render(p.scratch.allocator());
- try std.testing.expect(p.settings.tree_context_tag_style);
const full_height = p.surface.body_layers[0].viewport.h;
try std.testing.expect(p.surface.body_layers[0].rows > full_height);
try std.testing.expectEqual(FontRole.tagline, p.surface.body_layers[0].cells[0].style.font_role);
@@ -2408,16 +2407,6 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest
_ = try p.render(p.scratch.allocator());
try std.testing.expectEqual(full_height, p.surface.body_layers[0].viewport.h);
p.prefix = .none;
- try std.testing.expect(p.executeBuiltinLine(0, "TreeContextTagStyle"));
- p.sync();
- _ = try p.render(p.scratch.allocator());
- try std.testing.expectEqual(@as(u16, 0), p.surface.body_layers[0].rows);
- try std.testing.expectEqual(@as(u16, 0), pane.body_rows);
- try std.testing.expectEqual(FontRole.body, p.surface.at(r.x + config.GUTTER, p.bodyTop(pane, r)).style.font_role);
- try dump.dumpState(p);
- const restored = try dump.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?);
- defer restored.deinit();
- try std.testing.expect(!restored.settings.tree_context_tag_style);
}
test "TreeContext command and custom tag survive a workspace round trip" {
@@ -3452,8 +3441,6 @@ test "tabbed file aligns syntax cursor and mouse at the nearest insertion gap" {
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 60, .rows = 12 });
defer p.deinit();
- // Bold is an explicit preference; use it to expose the glyph boundaries.
- try std.testing.expect(p.executeBuiltinLine(0, "SyntaxBold"));
const pane = try p.setTestFile("\treturn x\n");
const f = &pane.file.?;
f.highlights = try p.tree_sitter_gpa.alloc(u8, f.content.len);
@@ -3469,10 +3456,12 @@ test "tabbed file aligns syntax cursor and mouse at the nearest insertion gap" {
const rect = p.rects[0];
const text_x = rect.x + config.GUTTER + config.PREFIX_W;
const body_y = rect.y + BOX_H;
+ // The keyword's ink shows the glyph boundaries.
+ const kw: Color = .{ .rgb = p.theme().kw };
for (0..config.tab_width) |col|
- try std.testing.expect(!surface.at(text_x + @as(u16, @intCast(col)), body_y).style.bold);
+ try std.testing.expect(!std.meta.eql(kw, surface.at(text_x + @as(u16, @intCast(col)), body_y).style.fg));
for (0.."return".len) |col|
- try std.testing.expect(surface.at(text_x + config.tab_width + @as(u16, @intCast(col)), body_y).style.bold);
+ try std.testing.expectEqual(kw, surface.at(text_x + config.tab_width + @as(u16, @intCast(col)), body_y).style.fg);
try std.testing.expectEqual(text_x + config.tab_width, surface.cursor.?.x);
const click_x = text_x + config.tab_width + 2;