summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sam Atman2025-05-04 18:37:58 -0400
committerGravatar Sam Atman2025-05-04 18:37:58 -0400
commita18ba77eb447e7c082f7d11504f21917871f4ac3 (patch)
treedc241a02aedce1fbd201ec3868328216b0df1c5d
parentRemove inner setup from GeneralCategories (diff)
downloadzg-a18ba77eb447e7c082f7d11504f21917871f4ac3.tar.gz
zg-a18ba77eb447e7c082f7d11504f21917871f4ac3.tar.xz
zg-a18ba77eb447e7c082f7d11504f21917871f4ac3.zip
Make DisplayWidth.setup publicv0.14.0-rc2
Also adds setupWithGraphemes variant.
-rw-r--r--src/DisplayWidth.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/DisplayWidth.zig b/src/DisplayWidth.zig
index 4c63be4..3da2d24 100644
--- a/src/DisplayWidth.zig
+++ b/src/DisplayWidth.zig
@@ -31,8 +31,14 @@ pub fn initWithGraphemes(allocator: Allocator, graphemes: Graphemes) Allocator.E
31 return dw; 31 return dw;
32} 32}
33 33
34pub fn setupWithGraphemes(dw: *DisplayWidth, allocator: Allocator, graphemes: Graphemes) Allocator.Error!void {
35 try dw.setup(allocator);
36 dw.graphemes = graphemes;
37 dw.owns_graphemes = false;
38}
39
34// Sets up the DisplayWidthData, leaving the GraphemeData undefined. 40// Sets up the DisplayWidthData, leaving the GraphemeData undefined.
35fn setup(dw: *DisplayWidth, allocator: Allocator) Allocator.Error!void { 41pub fn setup(dw: *DisplayWidth, allocator: Allocator) Allocator.Error!void {
36 const decompressor = compress.flate.inflate.decompressor; 42 const decompressor = compress.flate.inflate.decompressor;
37 const in_bytes = @embedFile("dwp"); 43 const in_bytes = @embedFile("dwp");
38 var in_fbs = std.io.fixedBufferStream(in_bytes); 44 var in_fbs = std.io.fixedBufferStream(in_bytes);