this repo has no description
13
fork

Configure Feed

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

update to Zig 0.15.1

+55 -43
+3 -3
build.zig.zon
··· 10 10 .hash = "zigimg-0.1.0-8_eo2mWmEgBoqdr0sH9O5GTqDHthkoEPM5_tipcBRreL", 11 11 }, 12 12 .zg = .{ 13 - // TODO .url = "git+https://codeberg.org/atman/zg", 14 - .url = "git+https://codeberg.org/ivanstepanovftw/zg#4fe689e56ce2ed5a8f59308b471bccd7da89fac9", 15 - .hash = "zg-0.14.1-oGqU3J4_tAKBfyes3AWleKDjo-IcYvnEwaB8qxOqFMwM", 13 + // Upstream PR: https://codeberg.org/atman/zg/pulls/90/ 14 + .url = "https://codeberg.org/chaten/zg/archive/749197a3f9d25e211615960c02380a3d659b20f9.tar.gz", 15 + .hash = "zg-0.15.1-oGqU3M0-tALZCy7boQS86znlBloyKx6--JriGlY0Paa9", 16 16 }, 17 17 }, 18 18 .paths = .{
+4 -4
src/tty.zig
··· 722 722 fd: posix.fd_t, 723 723 pipe_read: posix.fd_t, 724 724 pipe_write: posix.fd_t, 725 - writer: *std.ArrayList(u8), 725 + writer: *std.io.Writer.Allocating, 726 726 727 727 /// Initializes a TestTty. 728 728 pub fn init() !TestTty { 729 729 if (builtin.os.tag == .windows) return error.SkipZigTest; 730 - const list = try std.testing.allocator.create(std.ArrayList(u8)); 731 - list.* = std.ArrayList(u8).init(std.testing.allocator); 730 + const list = try std.testing.allocator.create(std.io.Writer.Allocating); 731 + list.* = .init(std.testing.allocator); 732 732 const r, const w = try posix.pipe(); 733 733 return .{ 734 734 .fd = r, ··· 750 750 if (std.mem.eql(u8, bytes, ctlseqs.device_status_report)) { 751 751 _ = posix.write(self.pipe_write, "\x1b") catch {}; 752 752 } 753 - return self.writer.writer().write(bytes); 753 + return self.writer.writer.write(bytes); 754 754 } 755 755 756 756 pub fn opaqueWrite(ptr: *const anyopaque, bytes: []const u8) !usize {
+3 -2
src/vxfw/Button.zig
··· 138 138 139 139 // Event handlers need a context 140 140 var ctx: vxfw.EventContext = .{ 141 - .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator), 141 + .alloc = std.testing.allocator, 142 + .cmds = .empty, 142 143 }; 143 - defer ctx.cmds.deinit(); 144 + defer ctx.cmds.deinit(ctx.alloc); 144 145 145 146 // Get the widget interface 146 147 const b_widget = button.widget();
+2 -2
src/vxfw/FlexColumn.zig
··· 52 52 layout_arena.deinit(); 53 53 54 54 // make our children list 55 - var children = std.ArrayList(vxfw.SubSurface).init(ctx.arena); 55 + var children: std.ArrayList(vxfw.SubSurface) = .empty; 56 56 57 57 // Draw again, but with distributed heights 58 58 var second_pass_height: u16 = 0; ··· 75 75 ); 76 76 const surf = try child.widget.draw(child_ctx); 77 77 78 - try children.append(.{ 78 + try children.append(ctx.arena, .{ 79 79 .origin = .{ .col = 0, .row = second_pass_height }, 80 80 .surface = surf, 81 81 .z_index = 0,
+2 -2
src/vxfw/FlexRow.zig
··· 53 53 layout_arena.deinit(); 54 54 55 55 // make our children list 56 - var children = std.ArrayList(vxfw.SubSurface).init(ctx.arena); 56 + var children: std.ArrayList(vxfw.SubSurface) = .empty; 57 57 58 58 // Draw again, but with distributed widths 59 59 var second_pass_width: u16 = 0; ··· 75 75 ); 76 76 const surf = try child.widget.draw(child_ctx); 77 77 78 - try children.append(.{ 78 + try children.append(ctx.arena, .{ 79 79 .origin = .{ .col = second_pass_width, .row = 0 }, 80 80 .surface = surf, 81 81 .z_index = 0,
+11 -9
src/vxfw/ListView.zig
··· 243 243 upheight -= surf.size.height; 244 244 245 245 // Insert the child to the beginning of the list 246 - try child_list.insert(0, .{ 246 + try child_list.insert(ctx.arena, 0, .{ 247 247 .origin = .{ .col = if (self.draw_cursor) 2 else 0, .row = upheight }, 248 248 .surface = surf, 249 249 .z_index = 0, ··· 301 301 self.scroll.has_more = true; 302 302 } 303 303 304 - var child_list = std.ArrayList(vxfw.SubSurface).init(ctx.arena); 304 + var child_list: std.ArrayList(vxfw.SubSurface) = .empty; 305 305 306 306 // Accumulated height tracks how much height we have drawn. It's initial state is 307 307 // (scroll.offset + scroll.pending_lines) lines _above_ the surface top edge. ··· 362 362 const surf = try child.draw(child_ctx); 363 363 364 364 // Add the child surface to our list. It's offset from parent is the accumulated height 365 - try child_list.append(.{ 365 + try child_list.append(ctx.arena, .{ 366 366 .origin = .{ .col = child_offset, .row = accumulated_height }, 367 367 .surface = surf, 368 368 .z_index = 0, ··· 444 444 // unbounded drawing in scrollable areas 445 445 self.scroll.top = self.cursor; 446 446 self.scroll.offset = 0; 447 - child_list.deinit(); 448 - try child_list.append(.{ 447 + child_list.deinit(ctx.arena); 448 + try child_list.append(ctx.arena, .{ 449 449 .origin = .{ .col = 0, .row = 0 }, 450 450 .surface = sub.surface, 451 451 .z_index = 0, ··· 563 563 }; 564 564 // Event handlers need a context 565 565 var ctx: vxfw.EventContext = .{ 566 - .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator), 566 + .alloc = std.testing.allocator, 567 + .cmds = .empty, 567 568 }; 568 - defer ctx.cmds.deinit(); 569 + defer ctx.cmds.deinit(ctx.alloc); 569 570 570 571 try list_widget.handleEvent(&ctx, .{ .mouse = mouse_event }); 571 572 // Wheel up doesn't adjust the scroll ··· 730 731 }; 731 732 // Event handlers need a context 732 733 var ctx: vxfw.EventContext = .{ 733 - .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator), 734 + .alloc = std.testing.allocator, 735 + .cmds = .empty, 734 736 }; 735 - defer ctx.cmds.deinit(); 737 + defer ctx.cmds.deinit(ctx.alloc); 736 738 737 739 // Send a wheel down x 3 738 740 mouse_event.button = .wheel_down;
+4 -3
src/vxfw/RichText.zig
··· 161 161 len += span.text.len; 162 162 } 163 163 var arena = std.heap.ArenaAllocator.init(ctx.arena); 164 - var list = try std.ArrayList(vaxis.Cell).initCapacity(arena.allocator(), len); 164 + const alloc = arena.allocator(); 165 + var list: std.ArrayList(vaxis.Cell) = try .initCapacity(alloc, len); 165 166 166 167 for (spans) |span| { 167 168 var iter = ctx.graphemeIterator(span.text); ··· 174 175 .link = span.link, 175 176 }; 176 177 for (0..8) |_| { 177 - try list.append(cell); 178 + try list.append(alloc, cell); 178 179 } 179 180 continue; 180 181 } ··· 184 185 .style = span.style, 185 186 .link = span.link, 186 187 }; 187 - try list.append(cell); 188 + try list.append(alloc, cell); 188 189 } 189 190 } 190 191 return .{
+5 -5
src/vxfw/ScrollBars.zig
··· 329 329 } 330 330 331 331 pub fn draw(self: *ScrollBars, ctx: vxfw.DrawContext) Allocator.Error!vxfw.Surface { 332 - var children = std.ArrayList(vxfw.SubSurface).init(ctx.arena); 332 + var children: std.ArrayList(vxfw.SubSurface) = .empty; 333 333 334 334 // 1. If we're not drawing the scrollbars we can just draw the ScrollView directly. 335 335 336 336 if (!self.draw_vertical_scrollbar and !self.draw_horizontal_scrollbar) { 337 - try children.append(.{ 337 + try children.append(ctx.arena, .{ 338 338 .origin = .{ .row = 0, .col = 0 }, 339 339 .surface = try self.scroll_view.draw(ctx), 340 340 }); ··· 363 363 }, 364 364 )); 365 365 366 - try children.append(.{ 366 + try children.append(ctx.arena, .{ 367 367 .origin = .{ .row = 0, .col = 0 }, 368 368 .surface = scroll_view_surface, 369 369 }); ··· 456 456 self.vertical_thumb_top_row = thumb_top; 457 457 self.vertical_thumb_bottom_row = thumb_end_row; 458 458 459 - try children.append(.{ 459 + try children.append(ctx.arena, .{ 460 460 .origin = .{ .row = 0, .col = max.width -| 1 }, 461 461 .surface = scroll_bar, 462 462 }); ··· 520 520 } 521 521 self.horizontal_thumb_start_col = thumb_start; 522 522 self.horizontal_thumb_end_col = thumb_end; 523 - try children.append(.{ 523 + try children.append(ctx.arena, .{ 524 524 .origin = .{ .row = max.height -| 1, .col = 0 }, 525 525 .surface = scroll_bar, 526 526 });
+11 -9
src/vxfw/ScrollView.zig
··· 299 299 300 300 // Insert the child to the beginning of the list 301 301 const col_offset: i17 = if (self.draw_cursor) 2 else 0; 302 - try child_list.insert(0, .{ 302 + try child_list.insert(ctx.arena, 0, .{ 303 303 .origin = .{ .col = col_offset - @as(i17, @intCast(self.scroll.left)), .row = upheight }, 304 304 .surface = surf, 305 305 .z_index = 0, ··· 352 352 self.scroll.has_more_vertical = true; 353 353 } 354 354 355 - var child_list = std.ArrayList(vxfw.SubSurface).init(ctx.arena); 355 + var child_list: std.ArrayList(vxfw.SubSurface) = .empty; 356 356 357 357 // Accumulated height tracks how much height we have drawn. It's initial state is 358 358 // -(scroll.vertical_offset + scroll.pending_lines) lines _above_ the surface top edge. ··· 413 413 const surf = try child.draw(child_ctx); 414 414 415 415 // Add the child surface to our list. It's offset from parent is the accumulated height 416 - try child_list.append(.{ 416 + try child_list.append(ctx.arena, .{ 417 417 .origin = .{ .col = child_offset - @as(i17, @intCast(self.scroll.left)), .row = accumulated_height }, 418 418 .surface = surf, 419 419 .z_index = 0, ··· 501 501 // unbounded drawing in scrollable areas 502 502 self.scroll.top = self.cursor; 503 503 self.scroll.vertical_offset = 0; 504 - child_list.deinit(); 505 - try child_list.append(.{ 504 + child_list.deinit(ctx.arena); 505 + try child_list.append(ctx.arena, .{ 506 506 .origin = .{ .col = 0 - @as(i17, @intCast(self.scroll.left)), .row = 0 }, 507 507 .surface = sub.surface, 508 508 .z_index = 0, ··· 645 645 }; 646 646 // Event handlers need a context 647 647 var ctx: vxfw.EventContext = .{ 648 - .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator), 648 + .alloc = std.testing.allocator, 649 + .cmds = .empty, 649 650 }; 650 - defer ctx.cmds.deinit(); 651 + defer ctx.cmds.deinit(ctx.alloc); 651 652 652 653 try scroll_widget.handleEvent(&ctx, .{ .mouse = mouse_event }); 653 654 // Wheel up doesn't adjust the scroll ··· 1043 1044 }; 1044 1045 // Event handlers need a context 1045 1046 var ctx: vxfw.EventContext = .{ 1046 - .cmds = std.ArrayList(vxfw.Command).init(std.testing.allocator), 1047 + .alloc = std.testing.allocator, 1048 + .cmds = .empty, 1047 1049 }; 1048 - defer ctx.cmds.deinit(); 1050 + defer ctx.cmds.deinit(ctx.alloc); 1049 1051 1050 1052 // Send a wheel down x 3 1051 1053 mouse_event.button = .wheel_down;
+4 -1
src/vxfw/Spinner.zig
··· 123 123 124 124 // We are about to deliver the tick to the widget. We need an EventContext (the engine will 125 125 // provide this) 126 - var ctx: vxfw.EventContext = .{ .cmds = vxfw.CommandList.init(arena.allocator()) }; 126 + var ctx: vxfw.EventContext = .{ 127 + .alloc = arena.allocator(), 128 + .cmds = .empty, 129 + }; 127 130 128 131 // The event loop handles the tick event and calls us back with a .tick event. If we should keep 129 132 // running, we will add a new tick event
+2 -1
src/vxfw/SplitView.zig
··· 227 227 }; 228 228 229 229 var ctx: vxfw.EventContext = .{ 230 - .cmds = std.ArrayList(vxfw.Command).init(arena.allocator()), 230 + .alloc = arena.allocator(), 231 + .cmds = .empty, 231 232 }; 232 233 try split_widget.handleEvent(&ctx, .{ .mouse = mouse }); 233 234 // We should get a command to change the mouse shape
+2 -1
src/vxfw/TextField.zig
··· 567 567 _ = draw_ctx; 568 568 569 569 var ctx: vxfw.EventContext = .{ 570 - .cmds = vxfw.CommandList.init(arena.allocator()), 570 + .alloc = arena.allocator(), 571 + .cmds = .empty, 571 572 }; 572 573 573 574 // Enough boiler plate...Create the text field
+2 -1
src/vxfw/vxfw.zig
··· 99 99 100 100 pub const EventContext = struct { 101 101 phase: Phase = .at_target, 102 + alloc: Allocator, 102 103 cmds: CommandList, 103 104 104 105 /// The event was handled, do not pass it on ··· 115 116 }; 116 117 117 118 pub fn addCmd(self: *EventContext, cmd: Command) Allocator.Error!void { 118 - try self.cmds.append(cmd); 119 + try self.cmds.append(self.alloc, cmd); 119 120 } 120 121 121 122 pub fn tick(self: *EventContext, ms: u32, widget: Widget) Allocator.Error!void {