this repo has no description
13
fork

Configure Feed

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

vxfw(TextField): use ref to allocator to free onSubmit value

+4 -2
+4 -2
src/vxfw/TextField.zig
··· 104 104 return self.checkChanged(ctx); 105 105 } else if (key.matches(vaxis.Key.enter, .{}) or key.matches('j', .{ .ctrl = true })) { 106 106 if (self.onSubmit) |onSubmit| { 107 - const value = try self.buf.dupe(); 108 - defer self.buf.allocator.free(value); 107 + const value = try self.toOwnedSlice(); 108 + // Get a ref to the allocator in case onSubmit deinits the TextField 109 + const allocator = self.buf.allocator; 110 + defer allocator.free(value); 109 111 try onSubmit(self.userdata, ctx, value); 110 112 return ctx.consumeAndRedraw(); 111 113 }