mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 00:02:23 +00:00
docs(keymap): the two halves of a bad keybinding now read alike
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.
This commit is contained in:
+15
-2
@@ -177,7 +177,15 @@ fn action_bindings(effective: &[(String, String)]) -> Vec<KeyBinding> {
|
||||
));
|
||||
}
|
||||
}
|
||||
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"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user