only handle non-printables on press/release, and BS is 0x7F

This commit is contained in:
Mitchell Hashimoto
2022-08-24 10:18:05 -07:00
parent 622537d665
commit b33268cee3

View File

@ -598,10 +598,11 @@ fn keyCallback(
} }
// Handle non-printable characters // Handle non-printable characters
if (action == .press or action == .repeat) {
const char: u8 = switch (@bitCast(u8, mods)) { const char: u8 = switch (@bitCast(u8, mods)) {
// No modifiers pressed at all // No modifiers pressed at all
0 => @as(u8, switch (key) { 0 => @as(u8, switch (key) {
.backspace => 0x08, .backspace => 0x7F,
.enter => '\r', .enter => '\r',
.tab => '\t', .tab => '\t',
.escape => 0x1B, .escape => 0x1B,
@ -646,6 +647,7 @@ fn keyCallback(
log.err("error queueing write in keyCallback err={}", .{err}); log.err("error queueing write in keyCallback err={}", .{err});
} }
} }
}
fn focusCallback(window: glfw.Window, focused: bool) void { fn focusCallback(window: glfw.Window, focused: bool) void {
const tracy = trace(@src()); const tracy = trace(@src());