Fixed intcast issue by adding upper_letters and digits []u8s and map a to z kysms to said []u8s
Browse files
+6 −3 src/overlay.zig
| @@ -311,6 +311,9 @@ pub const Keybind_Overlay = struct { | |||
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | fn keysym_to_name(keysym: u64) []const u8 { | 313 | fn keysym_to_name(keysym: u64) []const u8 { |
| 314 | + const upper_letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
| 315 | + const digits = "0123456789"; | ||
| 316 | + | ||
| 314 | return switch (keysym) { | 317 | return switch (keysym) { |
| 315 | 0xff0d => "Return", | 318 | 0xff0d => "Return", |
| 316 | 0x0020 => "Space", | 319 | 0x0020 => "Space", |
| @@ -336,9 +339,9 @@ pub const Keybind_Overlay = struct { | |||
| 336 | 0x002c => ",", | 339 | 0x002c => ",", |
| 337 | 0x002e => ".", | 340 | 0x002e => ".", |
| 338 | 0x002f => "/", | 341 | 0x002f => "/", |
| 339 | - 'a'...'z' => |c| &[_]u8{@intCast(c - 32)}, | 342 | + 'a'...'z' => |c| upper_letters[c - 'a' ..][0..1], |
| 340 | - 'A'...'Z' => |c| &[_]u8{@intCast(c)}, | 343 | + 'A'...'Z' => |c| upper_letters[c - 'A' ..][0..1], |
| 341 | - '0'...'9' => |c| &[_]u8{@intCast(c)}, | 344 | + '0'...'9' => |c| digits[c - '0' ..][0..1], |
| 342 | else => "?", | 345 | else => "?", |
| 343 | }; | 346 | }; |
| 344 | } | 347 | } |