this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

deps: update zg

+86 -87
+2 -2
build.zig
··· 22 22 .optimize = optimize, 23 23 }); 24 24 vaxis_mod.addImport("code_point", zg_dep.module("code_point")); 25 - vaxis_mod.addImport("grapheme", zg_dep.module("grapheme")); 25 + vaxis_mod.addImport("Graphemes", zg_dep.module("Graphemes")); 26 26 vaxis_mod.addImport("DisplayWidth", zg_dep.module("DisplayWidth")); 27 27 vaxis_mod.addImport("zigimg", zigimg_dep.module("zigimg")); 28 28 ··· 66 66 .optimize = optimize, 67 67 }); 68 68 tests.root_module.addImport("code_point", zg_dep.module("code_point")); 69 - tests.root_module.addImport("grapheme", zg_dep.module("grapheme")); 69 + tests.root_module.addImport("Graphemes", zg_dep.module("Graphemes")); 70 70 tests.root_module.addImport("DisplayWidth", zg_dep.module("DisplayWidth")); 71 71 tests.root_module.addImport("zigimg", zigimg_dep.module("zigimg")); 72 72
+2 -2
build.zig.zon
··· 9 9 .hash = "zigimg-0.1.0-8_eo2nWlEgCddu8EGLOM_RkYshx3sC8tWv-yYA4-htS6", 10 10 }, 11 11 .zg = .{ 12 - .url = "git+https://codeberg.org/atman/zg#4a002763419a34d61dcbb1f415821b83b9bf8ddc", 13 - .hash = "zg-0.13.4-AAAAAGiZ7QLz4pvECFa_wG4O4TP4FLABHHbemH2KakWM", 12 + .url = "git+https://codeberg.org/atman/zg#0b05141b033043c5f7bcd72048a48eef6531ea6c", 13 + .hash = "zg-0.14.0-oGqU3KEFswIffnDu8eAE2XlhzwcfgjwtM6akIc5L7cEV", 14 14 }, 15 15 }, 16 16 .paths = .{
+3 -3
src/Loop.zig
··· 1 1 const std = @import("std"); 2 2 const builtin = @import("builtin"); 3 3 4 - const grapheme = @import("grapheme"); 4 + const Graphemes = @import("Graphemes"); 5 5 6 6 const GraphemeCache = @import("GraphemeCache.zig"); 7 7 const Parser = @import("Parser.zig"); ··· 47 47 if (self.thread) |_| return; 48 48 self.thread = try std.Thread.spawn(.{}, Self.ttyRun, .{ 49 49 self, 50 - &self.vaxis.unicode.width_data.g_data, 50 + &self.vaxis.unicode.width_data.graphemes, 51 51 self.vaxis.opts.system_clipboard_allocator, 52 52 }); 53 53 } ··· 107 107 /// read input from the tty. This is run in a separate thread 108 108 fn ttyRun( 109 109 self: *Self, 110 - grapheme_data: *const grapheme.GraphemeData, 110 + grapheme_data: *const Graphemes, 111 111 paste_allocator: ?std.mem.Allocator, 112 112 ) !void { 113 113 // initialize a grapheme cache
+51 -51
src/Parser.zig
··· 5 5 const Key = @import("Key.zig"); 6 6 const Mouse = @import("Mouse.zig"); 7 7 const code_point = @import("code_point"); 8 - const grapheme = @import("grapheme"); 8 + const Graphemes = @import("Graphemes"); 9 9 const Winsize = @import("main.zig").Winsize; 10 10 11 11 const log = std.log.scoped(.vaxis_parser); ··· 45 45 // text-as-codepoints 46 46 buf: [128]u8 = undefined, 47 47 48 - grapheme_data: *const grapheme.GraphemeData, 48 + grapheme_data: *const Graphemes, 49 49 50 50 /// Parse the first event from the input buffer. If a completion event is not 51 51 /// present, Result.event will be null and Result.n will be 0 ··· 81 81 } 82 82 83 83 /// Parse ground state 84 - inline fn parseGround(input: []const u8, data: *const grapheme.GraphemeData) !Result { 84 + inline fn parseGround(input: []const u8, data: *const Graphemes) !Result { 85 85 std.debug.assert(input.len > 0); 86 86 87 87 const b = input[0]; ··· 116 116 117 117 // Check if we have a multi-codepoint grapheme 118 118 var code = cp.code; 119 - var g_state: grapheme.State = .{}; 119 + var g_state: Graphemes.State = .{}; 120 120 var prev_cp = code; 121 121 while (iter.next()) |next_cp| { 122 - if (grapheme.graphemeBreak(prev_cp, next_cp.code, data, &g_state)) { 122 + if (Graphemes.graphemeBreak(prev_cp, next_cp.code, data, &g_state)) { 123 123 break; 124 124 } 125 125 prev_cp = next_cp.code; ··· 716 716 717 717 test "parse: single xterm keypress" { 718 718 const alloc = testing.allocator_instance.allocator(); 719 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 720 - defer grapheme_data.deinit(); 719 + const grapheme_data = try Graphemes.init(alloc); 720 + defer grapheme_data.deinit(alloc); 721 721 const input = "a"; 722 722 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 723 723 const result = try parser.parse(input, alloc); ··· 733 733 734 734 test "parse: single xterm keypress backspace" { 735 735 const alloc = testing.allocator_instance.allocator(); 736 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 737 - defer grapheme_data.deinit(); 736 + const grapheme_data = try Graphemes.init(alloc); 737 + defer grapheme_data.deinit(alloc); 738 738 const input = "\x08"; 739 739 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 740 740 const result = try parser.parse(input, alloc); ··· 749 749 750 750 test "parse: single xterm keypress with more buffer" { 751 751 const alloc = testing.allocator_instance.allocator(); 752 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 753 - defer grapheme_data.deinit(); 752 + const grapheme_data = try Graphemes.init(alloc); 753 + defer grapheme_data.deinit(alloc); 754 754 const input = "ab"; 755 755 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 756 756 const result = try parser.parse(input, alloc); ··· 767 767 768 768 test "parse: xterm escape keypress" { 769 769 const alloc = testing.allocator_instance.allocator(); 770 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 771 - defer grapheme_data.deinit(); 770 + const grapheme_data = try Graphemes.init(alloc); 771 + defer grapheme_data.deinit(alloc); 772 772 const input = "\x1b"; 773 773 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 774 774 const result = try parser.parse(input, alloc); ··· 781 781 782 782 test "parse: xterm ctrl+a" { 783 783 const alloc = testing.allocator_instance.allocator(); 784 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 785 - defer grapheme_data.deinit(); 784 + const grapheme_data = try Graphemes.init(alloc); 785 + defer grapheme_data.deinit(alloc); 786 786 const input = "\x01"; 787 787 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 788 788 const result = try parser.parse(input, alloc); ··· 795 795 796 796 test "parse: xterm alt+a" { 797 797 const alloc = testing.allocator_instance.allocator(); 798 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 799 - defer grapheme_data.deinit(); 798 + const grapheme_data = try Graphemes.init(alloc); 799 + defer grapheme_data.deinit(alloc); 800 800 const input = "\x1ba"; 801 801 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 802 802 const result = try parser.parse(input, alloc); ··· 809 809 810 810 test "parse: xterm key up" { 811 811 const alloc = testing.allocator_instance.allocator(); 812 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 813 - defer grapheme_data.deinit(); 812 + const grapheme_data = try Graphemes.init(alloc); 813 + defer grapheme_data.deinit(alloc); 814 814 { 815 815 // normal version 816 816 const input = "\x1b[A"; ··· 838 838 839 839 test "parse: xterm shift+up" { 840 840 const alloc = testing.allocator_instance.allocator(); 841 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 842 - defer grapheme_data.deinit(); 841 + const grapheme_data = try Graphemes.init(alloc); 842 + defer grapheme_data.deinit(alloc); 843 843 const input = "\x1b[1;2A"; 844 844 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 845 845 const result = try parser.parse(input, alloc); ··· 852 852 853 853 test "parse: xterm insert" { 854 854 const alloc = testing.allocator_instance.allocator(); 855 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 856 - defer grapheme_data.deinit(); 855 + const grapheme_data = try Graphemes.init(alloc); 856 + defer grapheme_data.deinit(alloc); 857 857 const input = "\x1b[2~"; 858 858 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 859 859 const result = try parser.parse(input, alloc); ··· 866 866 867 867 test "parse: paste_start" { 868 868 const alloc = testing.allocator_instance.allocator(); 869 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 870 - defer grapheme_data.deinit(); 869 + const grapheme_data = try Graphemes.init(alloc); 870 + defer grapheme_data.deinit(alloc); 871 871 const input = "\x1b[200~"; 872 872 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 873 873 const result = try parser.parse(input, alloc); ··· 879 879 880 880 test "parse: paste_end" { 881 881 const alloc = testing.allocator_instance.allocator(); 882 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 883 - defer grapheme_data.deinit(); 882 + const grapheme_data = try Graphemes.init(alloc); 883 + defer grapheme_data.deinit(alloc); 884 884 const input = "\x1b[201~"; 885 885 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 886 886 const result = try parser.parse(input, alloc); ··· 892 892 893 893 test "parse: osc52 paste" { 894 894 const alloc = testing.allocator_instance.allocator(); 895 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 896 - defer grapheme_data.deinit(); 895 + const grapheme_data = try Graphemes.init(alloc); 896 + defer grapheme_data.deinit(alloc); 897 897 const input = "\x1b]52;c;b3NjNTIgcGFzdGU=\x1b\\"; 898 898 const expected_text = "osc52 paste"; 899 899 var parser: Parser = .{ .grapheme_data = &grapheme_data }; ··· 911 911 912 912 test "parse: focus_in" { 913 913 const alloc = testing.allocator_instance.allocator(); 914 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 915 - defer grapheme_data.deinit(); 914 + const grapheme_data = try Graphemes.init(alloc); 915 + defer grapheme_data.deinit(alloc); 916 916 const input = "\x1b[I"; 917 917 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 918 918 const result = try parser.parse(input, alloc); ··· 924 924 925 925 test "parse: focus_out" { 926 926 const alloc = testing.allocator_instance.allocator(); 927 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 928 - defer grapheme_data.deinit(); 927 + const grapheme_data = try Graphemes.init(alloc); 928 + defer grapheme_data.deinit(alloc); 929 929 const input = "\x1b[O"; 930 930 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 931 931 const result = try parser.parse(input, alloc); ··· 937 937 938 938 test "parse: kitty: shift+a without text reporting" { 939 939 const alloc = testing.allocator_instance.allocator(); 940 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 941 - defer grapheme_data.deinit(); 940 + const grapheme_data = try Graphemes.init(alloc); 941 + defer grapheme_data.deinit(alloc); 942 942 const input = "\x1b[97:65;2u"; 943 943 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 944 944 const result = try parser.parse(input, alloc); ··· 956 956 957 957 test "parse: kitty: alt+shift+a without text reporting" { 958 958 const alloc = testing.allocator_instance.allocator(); 959 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 960 - defer grapheme_data.deinit(); 959 + const grapheme_data = try Graphemes.init(alloc); 960 + defer grapheme_data.deinit(alloc); 961 961 const input = "\x1b[97:65;4u"; 962 962 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 963 963 const result = try parser.parse(input, alloc); ··· 974 974 975 975 test "parse: kitty: a without text reporting" { 976 976 const alloc = testing.allocator_instance.allocator(); 977 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 978 - defer grapheme_data.deinit(); 977 + const grapheme_data = try Graphemes.init(alloc); 978 + defer grapheme_data.deinit(alloc); 979 979 const input = "\x1b[97u"; 980 980 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 981 981 const result = try parser.parse(input, alloc); ··· 990 990 991 991 test "parse: kitty: release event" { 992 992 const alloc = testing.allocator_instance.allocator(); 993 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 994 - defer grapheme_data.deinit(); 993 + const grapheme_data = try Graphemes.init(alloc); 994 + defer grapheme_data.deinit(alloc); 995 995 const input = "\x1b[97;1:3u"; 996 996 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 997 997 const result = try parser.parse(input, alloc); ··· 1006 1006 1007 1007 test "parse: single codepoint" { 1008 1008 const alloc = testing.allocator_instance.allocator(); 1009 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 1010 - defer grapheme_data.deinit(); 1009 + const grapheme_data = try Graphemes.init(alloc); 1010 + defer grapheme_data.deinit(alloc); 1011 1011 const input = "🙂"; 1012 1012 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 1013 1013 const result = try parser.parse(input, alloc); ··· 1023 1023 1024 1024 test "parse: single codepoint with more in buffer" { 1025 1025 const alloc = testing.allocator_instance.allocator(); 1026 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 1027 - defer grapheme_data.deinit(); 1026 + const grapheme_data = try Graphemes.init(alloc); 1027 + defer grapheme_data.deinit(alloc); 1028 1028 const input = "🙂a"; 1029 1029 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 1030 1030 const result = try parser.parse(input, alloc); ··· 1040 1040 1041 1041 test "parse: multiple codepoint grapheme" { 1042 1042 const alloc = testing.allocator_instance.allocator(); 1043 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 1044 - defer grapheme_data.deinit(); 1043 + const grapheme_data = try Graphemes.init(alloc); 1044 + defer grapheme_data.deinit(alloc); 1045 1045 const input = "👩‍🚀"; 1046 1046 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 1047 1047 const result = try parser.parse(input, alloc); ··· 1057 1057 1058 1058 test "parse: multiple codepoint grapheme with more after" { 1059 1059 const alloc = testing.allocator_instance.allocator(); 1060 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 1061 - defer grapheme_data.deinit(); 1060 + const grapheme_data = try Graphemes.init(alloc); 1061 + defer grapheme_data.deinit(alloc); 1062 1062 const input = "👩‍🚀abc"; 1063 1063 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 1064 1064 const result = try parser.parse(input, alloc); ··· 1189 1189 1190 1190 test "parse: disambiguate shift + space" { 1191 1191 const alloc = testing.allocator_instance.allocator(); 1192 - const grapheme_data = try grapheme.GraphemeData.init(alloc); 1193 - defer grapheme_data.deinit(); 1192 + const grapheme_data = try Graphemes.init(alloc); 1193 + defer grapheme_data.deinit(alloc); 1194 1194 const input = "\x1b[32;2u"; 1195 1195 var parser: Parser = .{ .grapheme_data = &grapheme_data }; 1196 1196 const result = try parser.parse(input, alloc);
+7 -7
src/Unicode.zig
··· 1 1 const std = @import("std"); 2 - const grapheme = @import("grapheme"); 2 + const Graphemes = @import("Graphemes"); 3 3 const DisplayWidth = @import("DisplayWidth"); 4 4 5 5 /// A thin wrapper around zg data 6 6 const Unicode = @This(); 7 7 8 - width_data: DisplayWidth.DisplayWidthData, 8 + width_data: DisplayWidth, 9 9 10 10 /// initialize all unicode data vaxis may possibly need 11 11 pub fn init(alloc: std.mem.Allocator) !Unicode { 12 12 return .{ 13 - .width_data = try DisplayWidth.DisplayWidthData.init(alloc), 13 + .width_data = try DisplayWidth.init(alloc), 14 14 }; 15 15 } 16 16 17 17 /// free all data 18 - pub fn deinit(self: *const Unicode) void { 19 - self.width_data.deinit(); 18 + pub fn deinit(self: *const Unicode, alloc: std.mem.Allocator) void { 19 + self.width_data.deinit(alloc); 20 20 } 21 21 22 22 /// creates a grapheme iterator based on str 23 - pub fn graphemeIterator(self: *const Unicode, str: []const u8) grapheme.Iterator { 24 - return grapheme.Iterator.init(str, &self.width_data.g_data); 23 + pub fn graphemeIterator(self: *const Unicode, str: []const u8) Graphemes.Iterator { 24 + return self.width_data.graphemes.iterator(str); 25 25 }
+1 -1
src/Vaxis.zig
··· 119 119 if (alloc) |a| { 120 120 self.screen.deinit(a); 121 121 self.screen_last.deinit(a); 122 + self.unicode.deinit(a); 122 123 } 123 - self.unicode.deinit(); 124 124 } 125 125 126 126 /// resets enabled features, sends cursor to home and clears below cursor
+2 -2
src/Window.zig
··· 564 564 test "print: grapheme" { 565 565 const alloc = std.testing.allocator_instance.allocator(); 566 566 const unicode = try Unicode.init(alloc); 567 - defer unicode.deinit(); 567 + defer unicode.deinit(alloc); 568 568 var screen: Screen = .{ .width_method = .unicode, .unicode = &unicode }; 569 569 const win: Window = .{ 570 570 .x_off = 0, ··· 630 630 test "print: word" { 631 631 const alloc = std.testing.allocator_instance.allocator(); 632 632 const unicode = try Unicode.init(alloc); 633 - defer unicode.deinit(); 633 + defer unicode.deinit(alloc); 634 634 var screen: Screen = .{ 635 635 .width_method = .unicode, 636 636 .unicode = &unicode,
+10 -11
src/gwidth.zig
··· 12 12 }; 13 13 14 14 /// returns the width of the provided string, as measured by the method chosen 15 - pub fn gwidth(str: []const u8, method: Method, data: *const DisplayWidth.DisplayWidthData) u16 { 15 + pub fn gwidth(str: []const u8, method: Method, data: *const DisplayWidth) u16 { 16 16 switch (method) { 17 17 .unicode => { 18 - const dw: DisplayWidth = .{ .data = data }; 19 - return @intCast(dw.strWidth(str)); 18 + return @intCast(data.strWidth(str)); 20 19 }, 21 20 .wcwidth => { 22 21 var total: u16 = 0; ··· 45 44 46 45 test "gwidth: a" { 47 46 const alloc = testing.allocator_instance.allocator(); 48 - const data = try DisplayWidth.DisplayWidthData.init(alloc); 49 - defer data.deinit(); 47 + const data = try DisplayWidth.init(alloc); 48 + defer data.deinit(alloc); 50 49 try testing.expectEqual(1, gwidth("a", .unicode, &data)); 51 50 try testing.expectEqual(1, gwidth("a", .wcwidth, &data)); 52 51 try testing.expectEqual(1, gwidth("a", .no_zwj, &data)); ··· 54 53 55 54 test "gwidth: emoji with ZWJ" { 56 55 const alloc = testing.allocator_instance.allocator(); 57 - const data = try DisplayWidth.DisplayWidthData.init(alloc); 58 - defer data.deinit(); 56 + const data = try DisplayWidth.init(alloc); 57 + defer data.deinit(alloc); 59 58 try testing.expectEqual(2, gwidth("👩‍🚀", .unicode, &data)); 60 59 try testing.expectEqual(4, gwidth("👩‍🚀", .wcwidth, &data)); 61 60 try testing.expectEqual(4, gwidth("👩‍🚀", .no_zwj, &data)); ··· 63 62 64 63 test "gwidth: emoji with VS16 selector" { 65 64 const alloc = testing.allocator_instance.allocator(); 66 - const data = try DisplayWidth.DisplayWidthData.init(alloc); 67 - defer data.deinit(); 65 + const data = try DisplayWidth.init(alloc); 66 + defer data.deinit(alloc); 68 67 try testing.expectEqual(2, gwidth("\xE2\x9D\xA4\xEF\xB8\x8F", .unicode, &data)); 69 68 try testing.expectEqual(1, gwidth("\xE2\x9D\xA4\xEF\xB8\x8F", .wcwidth, &data)); 70 69 try testing.expectEqual(2, gwidth("\xE2\x9D\xA4\xEF\xB8\x8F", .no_zwj, &data)); ··· 72 71 73 72 test "gwidth: emoji with skin tone selector" { 74 73 const alloc = testing.allocator_instance.allocator(); 75 - const data = try DisplayWidth.DisplayWidthData.init(alloc); 76 - defer data.deinit(); 74 + const data = try DisplayWidth.init(alloc); 75 + defer data.deinit(alloc); 77 76 try testing.expectEqual(2, gwidth("👋🏿", .unicode, &data)); 78 77 try testing.expectEqual(4, gwidth("👋🏿", .wcwidth, &data)); 79 78 try testing.expectEqual(2, gwidth("👋🏿", .no_zwj, &data));
+1 -1
src/main.zig
··· 27 27 pub const gwidth = @import("gwidth.zig"); 28 28 pub const ctlseqs = @import("ctlseqs.zig"); 29 29 pub const GraphemeCache = @import("GraphemeCache.zig"); 30 - pub const grapheme = @import("grapheme"); 30 + pub const Graphemes = @import("Graphemes"); 31 31 pub const Event = @import("event.zig").Event; 32 32 pub const Unicode = @import("Unicode.zig"); 33 33
+4 -4
src/vxfw/Text.zig
··· 294 294 295 295 test "SoftwrapIterator: LF breaks" { 296 296 const unicode = try vaxis.Unicode.init(std.testing.allocator); 297 - defer unicode.deinit(); 297 + defer unicode.deinit(std.testing.allocator); 298 298 vxfw.DrawContext.init(&unicode, .unicode); 299 299 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); 300 300 defer arena.deinit(); ··· 322 322 323 323 test "SoftwrapIterator: soft breaks that fit" { 324 324 const unicode = try vaxis.Unicode.init(std.testing.allocator); 325 - defer unicode.deinit(); 325 + defer unicode.deinit(std.testing.allocator); 326 326 vxfw.DrawContext.init(&unicode, .unicode); 327 327 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); 328 328 defer arena.deinit(); ··· 350 350 351 351 test "SoftwrapIterator: soft breaks that are longer than width" { 352 352 const unicode = try vaxis.Unicode.init(std.testing.allocator); 353 - defer unicode.deinit(); 353 + defer unicode.deinit(std.testing.allocator); 354 354 vxfw.DrawContext.init(&unicode, .unicode); 355 355 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); 356 356 defer arena.deinit(); ··· 388 388 389 389 test "SoftwrapIterator: soft breaks with leading spaces" { 390 390 const unicode = try vaxis.Unicode.init(std.testing.allocator); 391 - defer unicode.deinit(); 391 + defer unicode.deinit(std.testing.allocator); 392 392 vxfw.DrawContext.init(&unicode, .unicode); 393 393 var arena = std.heap.ArenaAllocator.init(std.testing.allocator); 394 394 defer arena.deinit();
+1 -1
src/vxfw/TextField.zig
··· 386 386 test "sliceToCursor" { 387 387 const alloc = std.testing.allocator_instance.allocator(); 388 388 const unicode = try Unicode.init(alloc); 389 - defer unicode.deinit(); 389 + defer unicode.deinit(alloc); 390 390 var input = init(alloc, &unicode); 391 391 defer input.deinit(); 392 392 try input.insertSliceAtCursor("hello, world");
+2 -2
src/vxfw/vxfw.zig
··· 1 1 const std = @import("std"); 2 2 const vaxis = @import("../main.zig"); 3 3 4 - const grapheme = vaxis.grapheme; 4 + const Graphemes = vaxis.Graphemes; 5 5 const testing = std.testing; 6 6 7 7 const assert = std.debug.assert; ··· 207 207 ); 208 208 } 209 209 210 - pub fn graphemeIterator(_: DrawContext, str: []const u8) grapheme.Iterator { 210 + pub fn graphemeIterator(_: DrawContext, str: []const u8) Graphemes.Iterator { 211 211 assert(DrawContext.unicode != null); // DrawContext not initialized 212 212 return DrawContext.unicode.?.graphemeIterator(str); 213 213 }