From 650b9d470a7b757d3875112a3895961717db5a28 Mon Sep 17 00:00:00 2001 From: Alessandro De Blasis Date: Thu, 26 Mar 2026 01:29:13 +0100 Subject: [PATCH] font: handle CRLF line endings in octants.txt parsing Trim trailing \r when splitting octants.txt by \n at comptime. On Windows, git may convert LF to CRLF on checkout, leaving \r at the end of each line. Without trimming, the parser tries to use \r as a struct field name in @field(), causing a compile error. Follows the same pattern used in x11_color.zig for rgb.txt parsing. --- .../draw/symbols_for_legacy_computing_supplement.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/font/sprite/draw/symbols_for_legacy_computing_supplement.zig b/src/font/sprite/draw/symbols_for_legacy_computing_supplement.zig index bd91d3925..46c7165a8 100644 --- a/src/font/sprite/draw/symbols_for_legacy_computing_supplement.zig +++ b/src/font/sprite/draw/symbols_for_legacy_computing_supplement.zig @@ -102,7 +102,14 @@ pub fn draw1CD00_1CDE5( const data = @embedFile("octants.txt"); var it = std.mem.splitScalar(u8, data, '\n'); - while (it.next()) |line| { + while (it.next()) |raw_line| { + // Trim \r so this works with both LF and CRLF line endings, + // since git may convert octants.txt to CRLF on Windows checkouts. + const line = if (raw_line.len > 0 and raw_line[raw_line.len - 1] == '\r') + raw_line[0 .. raw_line.len - 1] + else + raw_line; + // Skip comments if (line.len == 0 or line[0] == '#') continue;