From 5a09ce9f023b8a79cb6599ed788ad84be0244a5e Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 16 Aug 2026 09:40:47 +0800 Subject: [PATCH] docs(keymap): the two halves of a bad keybinding now read alike MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One line in config.json can go wrong two ways, and they were reported in two shapes: keybinding for unknown action "NewTabb" ignored ignoring keybinding for 'NewTab': invalid keystroke 'cmd-shft-t' Same news about the same setting, quoted differently and built differently. They now share a shape, so a reader scanning a log does not have to notice that they belong together. The third message in this file is a different audience and now says so. It fires only when the default list offers an action `make_binding` cannot build — `set_binding` has already turned away anything a config misspelled — which is a disagreement between two lists in this file, not a mistake in anyone's config. `every_dispatchable_action_has_a_slot_to_bind_it_in` exists to keep that from happening; if it ever reaches a user, the log should not blame their config for tty7's inconsistency. Both guards verified against a running GUI before and after: a bad action name and a bad keystroke each named, the good binding beside them silent. Nothing else needed here. Unknown actions and invalid keystrokes were already caught — the same treatment the last two commits gave config values and unknown keys, arrived at independently in this file first. --- src/ui/keymap.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ui/keymap.rs b/src/ui/keymap.rs index 396340c6..8b167c71 100644 --- a/src/ui/keymap.rs +++ b/src/ui/keymap.rs @@ -177,7 +177,15 @@ fn action_bindings(effective: &[(String, String)]) -> Vec { )); } } - None => log::warn!("ignoring keybinding: unknown action '{action}'"), + // Not a typo in anyone's config: `set_binding` has already turned + // those away by name. Reaching here means the default list offers + // an action `make_binding` cannot build — a disagreement between + // two lists in this file, which `every_dispatchable_action_has_a_slot_to_bind_it_in` + // exists to keep from happening. Say so, rather than blaming the + // reader's config for tty7's own inconsistency. + None => log::warn!( + "keybinding for '{action}' dropped: tty7 offers this action but cannot bind it — please report it" + ), } } bindings @@ -736,7 +744,12 @@ fn set_binding(effective: &mut [(String, String)], action: &str, key: String) { Some(slot) => slot.1 = key, // A hand-edited config.json with a typo used to vanish into this // branch. The Keybindings page lists every name that works. - None => log::warn!("keybinding for unknown action {action:?} ignored"), + // + // Worded like its neighbour in `action_bindings`: the two report the + // two halves of one line in config.json, and a reader scanning the log + // should not have to notice that "unknown action" and "invalid + // keystroke" are the same kind of news about the same setting. + None => log::warn!("ignoring keybinding for '{action}': no such action"), } }