feat: use undo instead of delete_backward to revert initial chord keystroke

This commit is contained in:
CJ van den Berg 2024-10-22 19:32:06 +02:00
parent f0c8e35277
commit c02dcbaa08
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -102,22 +102,22 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
//chording
if (self.last_key.keypress == 'j' and self.last_key.modifiers == 0 and keypress == 'k' and modifiers == 0) {
try self.cmd("delete_backward", .{});
try self.cmd("undo", .{});
try self.cmd("enter_mode", command.fmt(.{"vim/normal"}));
return;
}
if (self.last_key.keypress == 'k' and self.last_key.modifiers == 0 and keypress == 'j' and modifiers == 0) {
try self.cmd("delete_backward", .{});
try self.cmd("undo", .{});
try self.cmd("enter_mode", command.fmt(.{"vim/normal"}));
return;
}
if (self.last_key.keypress == 'f' and self.last_key.modifiers == 0 and keypress == 'j' and modifiers == 0) {
try self.cmd("delete_backward", .{});
try self.cmd("undo", .{});
try self.cmd("enter_mode", command.fmt(.{"vim/normal"}));
return;
}
if (self.last_key.keypress == 'j' and self.last_key.modifiers == 0 and keypress == 'f' and modifiers == 0) {
try self.cmd("delete_backward", .{});
try self.cmd("undo", .{});
try self.cmd("enter_mode", command.fmt(.{"vim/normal"}));
return;
}