diff options
Diffstat (limited to 'src/File.zig')
| -rw-r--r-- | src/File.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/File.zig b/src/File.zig index c42e39ec..59b04e3f 100644 --- a/src/File.zig +++ b/src/File.zig @@ -251,7 +251,7 @@ pub fn dumpPane( fn dumpLocationRows(arena: std.mem.Allocator, rows: []const locations.Row) ![]const dump.LocationRow { const saved = try arena.alloc(dump.LocationRow, rows.len); for (rows, saved) |row, *out| out.* = .{ - .kind = @enumFromInt(@intFromEnum(row.kind)), + .kind = @fromBackingInt(@intCast(@backingInt(row.kind))), .declaration = row.declaration, .mark_occurrence = row.mark_occurrence, .source_column = row.source_column, @@ -336,10 +336,10 @@ fn restoreOutputLocationRows(gpa: std.mem.Allocator, content: []const u8, saved: const colors = try dump.decodeBytes(gpa, row.colors_b64); errdefer gpa.free(colors); if (colors.len != 0 and colors.len != code_len) return error.InvalidLocationRows; - for (colors) |color| if (color > @intFromEnum(syntax.Syn.comment)) return error.InvalidLocationRows; + for (colors) |color| if (color > @backingInt(syntax.Syn.comment)) return error.InvalidLocationRows; const path = try gpa.dupe(u8, row.path); out.* = .{ - .kind = @enumFromInt(@intFromEnum(row.kind)), + .kind = @fromBackingInt(@intCast(@backingInt(row.kind))), .declaration = row.declaration, .mark_occurrence = row.mark_occurrence, .source_column = row.source_column, @@ -1028,7 +1028,7 @@ pub fn restore(p: *Pardes, id: usize, src: dump.Pane) !*Pane { const colors = try dump.decodeBytes(p.gpa, saved.mini_colors_b64); errdefer p.gpa.free(colors); if (colors.len != content.len or colors.len > Mini.max_output_bytes) return error.InvalidMini; - for (colors) |color| if (color > @intFromEnum(syntax.Syn.comment)) return error.InvalidMini; + for (colors) |color| if (color > @backingInt(syntax.Syn.comment)) return error.InvalidMini; mini = .{ .source = source, .colors = colors }; } else if (saved.mini_colors_b64.len > 0) return error.InvalidMini; @@ -1984,7 +1984,7 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. if (if (tint != null and hs + c == 0) SynStyle{ .fg = tint.?.fg, .bold = true } else - synStyle(p, @enumFromInt(highlights[hidx] & syntax.syn_bits))) |ss| + synStyle(p, @fromBackingInt(@intCast(highlights[hidx] & syntax.syn_bits)))) |ss| { var fill: usize = 0; while (fill < cells and prefix_width + screen_c + fill < tw) : (fill += 1) { @@ -2189,7 +2189,7 @@ pub fn recolorDiffOutput(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, t // green is the tint's to say now: its code takes the page's ink. const paint: ?SynStyle = if (tint != null and prefix) .{ .fg = tint.?.fg, .bold = true } - else if (synStyle(p, @enumFromInt(style & syntax.syn_bits))) |ss| + else if (synStyle(p, @fromBackingInt(@intCast(style & syntax.syn_bits)))) |ss| ss else if (tint != null) .{ .fg = ink, .bold = false } |
