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 | 313 | fn keysym_to_name(keysym: u64) []const u8 { |
| 314 | + const upper_letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
| 315 | + const digits = "0123456789"; | |
| 316 | + | |
| 314 | 317 | return switch (keysym) { |
| 315 | 318 | 0xff0d => "Return", |
| 316 | 319 | 0x0020 => "Space", |
| @@ -336,9 +339,9 @@ pub const Keybind_Overlay = struct { | ||
| 336 | 339 | 0x002c => ",", |
| 337 | 340 | 0x002e => ".", |
| 338 | 341 | 0x002f => "/", |
| 339 | - 'a'...'z' => |c| &[_]u8{@intCast(c - 32)}, | |
| 340 | - 'A'...'Z' => |c| &[_]u8{@intCast(c)}, | |
| 341 | - '0'...'9' => |c| &[_]u8{@intCast(c)}, | |
| 342 | + 'a'...'z' => |c| upper_letters[c - 'a' ..][0..1], | |
| 343 | + 'A'...'Z' => |c| upper_letters[c - 'A' ..][0..1], | |
| 344 | + '0'...'9' => |c| digits[c - '0' ..][0..1], | |
| 342 | 345 | else => "?", |
| 343 | 346 | }; |
| 344 | 347 | } |