feat: log keyhints message on unbound key events

This commit is contained in:
CJ van den Berg 2025-12-01 22:23:32 +01:00
parent dad8deac7a
commit 49acb2c3d5
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

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