From 1f65d7368c9a31427b145f683eb891da16181b73 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 30 Jun 2026 15:32:56 -0300 Subject: merging the colors into --- term.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'term.zig') diff --git a/term.zig b/term.zig index 6989eb79..c4fe0d93 100644 --- a/term.zig +++ b/term.zig @@ -37,6 +37,9 @@ pub const File = struct { path: []const u8, // gpa-owned absolute path content: []u8, // gpa-owned file bytes scroll: usize = 0, // top visible file line + /// tree-sitter syntax styles, one byte per `content` byte (0 = none). Empty + /// when the file's language isn't highlighted. gpa-owned. See main.highlightFile. + highlights: []u8 = &.{}, }; /// A run of inserted ("char mode") text. `col` is the ORIGINAL tty column it is @@ -121,6 +124,7 @@ pub fn deinit(self: *Term, io: std.Io, gpa: std.mem.Allocator) void { if (self.file) |f| { gpa.free(f.path); gpa.free(f.content); + if (f.highlights.len > 0) gpa.free(f.highlights); } else if (self.image) |iv| { gpa.free(iv.path); } else { -- cgit v1.3