summaryrefslogtreecommitdiff
path: root/test/behaviour/panes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour/panes.zig')
-rw-r--r--test/behaviour/panes.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/behaviour/panes.zig b/test/behaviour/panes.zig
index 553b1ca9..9dfc6abd 100644
--- a/test/behaviour/panes.zig
+++ b/test/behaviour/panes.zig
@@ -548,3 +548,20 @@ test "panes: truncating body empties it, and a stat says the length after" {
try s.write(body, "new text\n");
try std.testing.expectEqual(@as(u64, 9), (try s.stat(body)).size);
}
+
+test "panes: a rename colours a source its new name's language names, its text unchanged" {
+ if (!@import("pardes_config").syntax_highlighting) return error.SkipZigTest;
+ var s = try Session.initFile(std.testing.allocator, "fn check() void {}\n");
+ defer s.deinit();
+ const n = try s.focused();
+ const x, const y = try s.where("fn check");
+ const screen = try s.screen();
+ const cols = try std.unicode.utf8CountCodepoints(screen[0..std.mem.indexOfScalar(u8, screen, '\n').?]);
+ const plain = try s.styles();
+ try std.testing.expectEqualStrings(plain[y * cols + x], plain[y * cols + x + 3]);
+ try s.write(s.at("/pane/{d}/name", .{n}), "renamed.zig\n");
+ const coloured = try s.styles();
+ try std.testing.expectEqualStrings(coloured[y * cols + x], coloured[y * cols + x + 1]);
+ try std.testing.expect(!std.mem.eql(u8, coloured[y * cols + x], plain[y * cols + x]));
+ try s.expect(s.at("/pane/{d}/body", .{n}), "fn check() void {}\n");
+}