Compare commits

..

2 commits

View file

@ -769,8 +769,11 @@ const BindingSet = struct {
fn terminate_sequence(self: *const @This(), abort_type: AbortType) anyerror!void {
if (abort_type == .match_impossible) {
switch (self.on_match_failure) {
.insert => try self.insert_bytes(globals.current_sequence_egc.items),
.ignore => {},
.insert => if (globals.current_sequence_egc.items.len > 0)
try self.insert_bytes(globals.current_sequence_egc.items)
else
log_keyhints_message(),
.ignore => log_keyhints_message(),
}
globals.current_sequence.clearRetainingCapacity();
globals.current_sequence_egc.clearRetainingCapacity();
@ -781,6 +784,19 @@ const BindingSet = struct {
}
}
fn log_keyhints_message() void {
for (globals.current_sequence.items) |item| switch (item.key) {
input.key.left_control, input.key.right_control => return,
input.key.left_alt, input.key.right_alt => return,
input.key.left_shift, input.key.right_shift => return,
else => {},
};
const logger = log.logger("keybind");
defer logger.deinit();
logger.print("C-? for key hints", .{});
}
/// Retrieve bindings that will match a key event sequence
pub fn get_matches_for_key_event_sequence(
self: *const @This(),