summaryrefslogtreecommitdiff
path: root/src/tui
diff options
context:
space:
mode:
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/tui.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tui/tui.zig b/src/tui/tui.zig
index 0daac14b..77c8ce2b 100644
--- a/src/tui/tui.zig
+++ b/src/tui/tui.zig
@@ -3344,3 +3344,17 @@ test "the tty draws a glide at whole rows: once a flick or a spin slows, its ste
try std.testing.expectEqual(row, (shown.cursor orelse return error.NoCursor).y);
}
}
+
+test "the tui's vaxis measures a grapheme as wide as the core lays it out" {
+ // vaxis renders a cell at gwidth(.unicode) in mode 2027; the core's
+ // File.utf8Width is that function over the same uucode tables. A vaxis
+ // that measures otherwise would draw past or short of the core's cells.
+ for ([_][]const u8{
+ "a", "\u{4e16}", "e\u{301}", "\u{301}",
+ "\u{1f642}", "\u{1f44b}\u{1f3ff}", "\u{1f469}\u{200d}\u{1f680}", "\u{1f1fa}\u{1f1f8}",
+ "\u{1f1fa}", "\u{2764}\u{fe0e}", "\u{2764}\u{fe0f}", "1\u{fe0f}\u{20e3}",
+ "\u{1100}\u{1161}", "\u{ff21}", "\u{b1}", "\u{200b}",
+ "\u{ad}", "\u{fffd}", "\u{85}", "\x7f",
+ "a\u{4e16}\u{1f642}", "\u{e0100}", "\u{231a}", "\u{2600}",
+ }) |g| try std.testing.expectEqual(vaxis.gwidth.gwidth(g, .unicode), pardes.panes.File.utf8Width(g));
+}