tty: handle key_release events

This commit is contained in:
Tim Culverhouse 2024-04-30 08:55:26 -05:00
parent 92883f5d42
commit df2f936317

View file

@ -138,6 +138,16 @@ pub fn run(
loop.postEvent(.{ .key_press = mut_key }); loop.postEvent(.{ .key_press = mut_key });
} }
}, },
.key_release => |*key| {
if (@hasField(Event, "key_release")) {
// HACK: yuck. there has to be a better way
var mut_key = key;
if (key.text) |text| {
mut_key.text = cache.put(text);
}
loop.postEvent(.{ .key_release = mut_key });
}
},
.mouse => |mouse| { .mouse => |mouse| {
if (@hasField(Event, "mouse")) { if (@hasField(Event, "mouse")) {
loop.postEvent(.{ .mouse = mouse }); loop.postEvent(.{ .mouse = mouse });