fix: ignore extended modifier bits
This commit is contained in:
parent
dc0274af31
commit
c1ce38daaa
1 changed files with 14 additions and 2 deletions
|
@ -146,7 +146,8 @@ pub fn leave_alternate_screen(self: *Self) void {
|
||||||
pub fn process_input_event(self: *Self, input_: []const u8) !void {
|
pub fn process_input_event(self: *Self, input_: []const u8) !void {
|
||||||
const event = std.mem.bytesAsValue(vaxis.Event, input_);
|
const event = std.mem.bytesAsValue(vaxis.Event, input_);
|
||||||
switch (event.*) {
|
switch (event.*) {
|
||||||
.key_press => |key_| {
|
.key_press => |key__| {
|
||||||
|
const key_ = filter_mods(key__);
|
||||||
try self.sync_mod_state(key_.codepoint, key_.mods);
|
try self.sync_mod_state(key_.codepoint, key_.mods);
|
||||||
const cbor_msg = try self.fmtmsg(.{
|
const cbor_msg = try self.fmtmsg(.{
|
||||||
"I",
|
"I",
|
||||||
|
@ -162,7 +163,8 @@ pub fn process_input_event(self: *Self, input_: []const u8) !void {
|
||||||
return e;
|
return e;
|
||||||
}) {} else if (self.dispatch_input) |f| f(self.handler_ctx, cbor_msg);
|
}) {} else if (self.dispatch_input) |f| f(self.handler_ctx, cbor_msg);
|
||||||
},
|
},
|
||||||
.key_release => |*key_| {
|
.key_release => |key__| {
|
||||||
|
const key_ = filter_mods(key__);
|
||||||
const cbor_msg = try self.fmtmsg(.{
|
const cbor_msg = try self.fmtmsg(.{
|
||||||
"I",
|
"I",
|
||||||
event_type.RELEASE,
|
event_type.RELEASE,
|
||||||
|
@ -369,6 +371,16 @@ fn send_sync_key(self: *Self, event_type_: usize, keypress: u32, key_string: []c
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn filter_mods(key_: vaxis.Key) vaxis.Key {
|
||||||
|
var key__ = key_;
|
||||||
|
key__.mods = .{
|
||||||
|
.shift = key_.mods.shift,
|
||||||
|
.alt = key_.mods.alt,
|
||||||
|
.ctrl = key_.mods.ctrl,
|
||||||
|
};
|
||||||
|
return key__;
|
||||||
|
}
|
||||||
|
|
||||||
const Loop = struct {
|
const Loop = struct {
|
||||||
tty: *vaxis.Tty,
|
tty: *vaxis.Tty,
|
||||||
vaxis: *vaxis.Vaxis,
|
vaxis: *vaxis.Vaxis,
|
||||||
|
|
Loading…
Add table
Reference in a new issue