Improve doc comments about keybinding order (#23014)
Release Notes: - N/A
This commit is contained in:
parent
daaa250109
commit
5785266c8c
4 changed files with 28 additions and 19 deletions
|
@ -3077,7 +3077,8 @@ impl<'a> WindowContext<'a> {
|
|||
false
|
||||
}
|
||||
|
||||
/// Represent this action as a key binding string, to display in the UI.
|
||||
/// Return a key binding string for an action, to display in the UI. Uses the highest precedence
|
||||
/// binding for the action (last binding added to the keymap).
|
||||
pub fn keystroke_text_for(&self, action: &dyn Action) -> String {
|
||||
self.bindings_for_action(action)
|
||||
.into_iter()
|
||||
|
@ -3734,7 +3735,8 @@ impl<'a> WindowContext<'a> {
|
|||
actions
|
||||
}
|
||||
|
||||
/// Returns key bindings that invoke the given action on the currently focused element.
|
||||
/// Returns key bindings that invoke an action on the currently focused element, in precedence
|
||||
/// order (reverse of the order they were added to the keymap).
|
||||
pub fn bindings_for_action(&self, action: &dyn Action) -> Vec<KeyBinding> {
|
||||
self.window
|
||||
.rendered_frame
|
||||
|
@ -3745,12 +3747,16 @@ impl<'a> WindowContext<'a> {
|
|||
)
|
||||
}
|
||||
|
||||
/// Returns key bindings that invoke the given action on the currently focused element.
|
||||
/// Returns key bindings that invoke the given action on the currently focused element, without
|
||||
/// checking context. Bindings are returned returned in precedence order (reverse of the order
|
||||
/// they were added to the keymap).
|
||||
pub fn all_bindings_for_input(&self, input: &[Keystroke]) -> Vec<KeyBinding> {
|
||||
RefCell::borrow(&self.keymap).all_bindings_for_input(input)
|
||||
}
|
||||
|
||||
/// Returns any bindings that would invoke the given action on the given focus handle if it were focused.
|
||||
/// Returns any bindings that would invoke an action on the given focus handle if it were
|
||||
/// focused. Bindings are returned returned in precedence order (reverse of the order
|
||||
/// they were added to the keymap).
|
||||
pub fn bindings_for_action_in(
|
||||
&self,
|
||||
action: &dyn Action,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue