summaryrefslogtreecommitdiff
path: root/term.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-06-30 15:32:56 -0300
committerGabriel Schneider <[email protected]>2026-06-30 17:43:21 -0300
commit1f65d7368c9a31427b145f683eb891da16181b73 (patch)
tree88a3754e7d01906098af82335b84edb8754f31ca /term.zig
parenta68564e9fb9fb8be6d997db5e6ad9148fb506d18 (diff)
downloadpardes-1f65d7368c9a31427b145f683eb891da16181b73.tar.gz
pardes-1f65d7368c9a31427b145f683eb891da16181b73.zip
merging the colors into
Diffstat (limited to 'term.zig')
-rw-r--r--term.zig4
1 files changed, 4 insertions, 0 deletions
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 {