refactor: convert editor.matches to an ArrayListUnmanaged

This commit is contained in:
CJ van den Berg 2025-05-27 20:25:18 +02:00
parent 99c2e8da4e
commit 12dd1e9c8a
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 8 additions and 8 deletions

View file

@ -88,7 +88,7 @@ fn dump_highlight(self: *Self, range: syntax.Range, scope: []const u8, id: u32,
if (self.theme) |theme| match.style = .{ .bg = theme.editor_gutter_modified.fg };
switch (self.editor.matches.items.len) {
0 => {
(self.editor.matches.addOne() catch return).* = match;
(self.editor.matches.addOne(self.editor.allocator) catch return).* = match;
update_match = .add;
},
1 => {
@ -116,7 +116,7 @@ fn dump_highlight(self: *Self, range: syntax.Range, scope: []const u8, id: u32,
var match_parent = ed.Match.from_selection(sel_parent);
if (self.theme) |theme| match_parent.style = .{ .bg = theme.editor_gutter_added.fg };
switch (update_match) {
.add => (self.editor.matches.addOne() catch return).* = match_parent,
.add => (self.editor.matches.addOne(self.editor.allocator) catch return).* = match_parent,
.set => self.editor.matches.items[1] = match_parent,
.no => {},
}