summaryrefslogtreecommitdiff
path: root/src/surface.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-16 22:46:21 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitb2163c0a53a6276bc8e1211e9a7c9584bb1ccb2e (patch)
treeb24a6c5991f6d79e8baecb24f2ad50e3a8e8035d /src/surface.zig
parentf2b02c455f2bcdfb905a015eefbb630a28b4b12e (diff)
downloadpardes-b2163c0a53a6276bc8e1211e9a7c9584bb1ccb2e.tar.gz
pardes-b2163c0a53a6276bc8e1211e9a7c9584bb1ccb2e.zip
width: the core measures a grapheme's cells over uucode itself, File.utf8Width beside graphemeDisplayWidth, so libvaxis leaves the core module (build.zig gives it to main.zig's roots alone, the tui's and the gui's); it is libvaxis's gwidth(.unicode) over the same uucode tables in one pass (a grapheme as wide as its widest code point, the text selector, the emoji selector, emoji presentation and a flag's pair as there), and returned the same width on every Unicode scalar value (1,112,064), 76 multi-codepoint graphemes and 2,000,000 random sequences of joiners, selectors, marks, jamo, regional indicators and any scalar, and graphemeDisplayWidth the same on 6,260,096 byte strings, invalid UTF-8 included (a test run once, then removed); 204 instructions a non-ASCII grapheme against vaxis's 309 (ReleaseFast), a render of perf's small file 11,679,818 instructions against 11,685,276; surface.zig and draw.zig's test call it; tui.zig's test holds vaxis's width to it on a corpus, as vaxis renders the cells the core lays out; the changelog says so
Diffstat (limited to 'src/surface.zig')
-rw-r--r--src/surface.zig3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/surface.zig b/src/surface.zig
index a5dbea8e..46b6c664 100644
--- a/src/surface.zig
+++ b/src/surface.zig
@@ -4,7 +4,6 @@ const pardes = @import("pardes.zig");
const std = @import("std");
const layout = @import("layout.zig");
const uucode = @import("uucode");
-const vaxis = @import("vaxis");
const panes = @import("panes.zig");
const config = @import("config.zig");
const MAX_PANES = pardes.MAX_PANES;
@@ -425,7 +424,7 @@ pub const Surface = struct {
const width: u16 = if (decoded == null or (cp < 0x80 and cp_slice.len == 1))
1
else
- @max(1, vaxis.gwidth.gwidth(cp_slice, .unicode));
+ @max(1, panes.File.utf8Width(cp_slice));
if (width == 2 and col + 1 >= end) return null;
var shown = cp_slice;
if (shown.len > @typeInfo(@FieldType(Cell, "text")).array.len) {