From fd97fff9311d622cc3142c8828a2ae2d1cb7f540 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 22 Jan 2024 20:14:15 -0600 Subject: [PATCH] text_input: add comment about ArrayList not being ideal Siged-off-by: Tim Culverhouse --- src/widgets/TextInput.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/widgets/TextInput.zig b/src/widgets/TextInput.zig index cc883d7..6a9cf65 100644 --- a/src/widgets/TextInput.zig +++ b/src/widgets/TextInput.zig @@ -18,6 +18,9 @@ const Event = union(enum) { cursor_idx: usize = 0, grapheme_count: usize = 0, +// TODO: an ArrayList is not great for this. orderedRemove is O(n) and we can +// only remove one byte at a time. Make a bespoke ArrayList which allows removal +// of a slice at a time, or truncating even would be nice buf: std.ArrayList(u8), pub fn init(alloc: std.mem.Allocator) TextInput {