add name to $env.config.keybindings (#14159)

# Description

This PR adds the `name` column back to keybindings.


This may be considered a hack since the reedline keybinding has no spot
for name, but it seems to work.
This commit is contained in:
Darren Schroeder 2024-10-23 12:23:41 -05:00 committed by GitHub
parent ae54d05930
commit 3a685049da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -711,6 +711,7 @@ pub(crate) fn create_keybindings(config: &Config) -> Result<KeybindingsMode, She
} }
for keybinding in parsed_keybindings { for keybinding in parsed_keybindings {
add_keybinding( add_keybinding(
&keybinding.name,
&keybinding.mode, &keybinding.mode,
keybinding, keybinding,
config, config,
@ -729,7 +730,9 @@ pub(crate) fn create_keybindings(config: &Config) -> Result<KeybindingsMode, She
} }
} }
#[allow(clippy::only_used_in_recursion)]
fn add_keybinding( fn add_keybinding(
name: &Option<Value>,
mode: &Value, mode: &Value,
keybinding: &ParsedKeybinding, keybinding: &ParsedKeybinding,
config: &Config, config: &Config,
@ -752,6 +755,7 @@ fn add_keybinding(
Value::List { vals, .. } => { Value::List { vals, .. } => {
for inner_mode in vals { for inner_mode in vals {
add_keybinding( add_keybinding(
name,
inner_mode, inner_mode,
keybinding, keybinding,
config, config,

View File

@ -5,6 +5,7 @@ use crate::{engine::Closure, FromValue};
/// Definition of a parsed keybinding from the config object /// Definition of a parsed keybinding from the config object
#[derive(Clone, Debug, FromValue, IntoValue, Serialize, Deserialize)] #[derive(Clone, Debug, FromValue, IntoValue, Serialize, Deserialize)]
pub struct ParsedKeybinding { pub struct ParsedKeybinding {
pub name: Option<Value>,
pub modifier: Value, pub modifier: Value,
pub keycode: Value, pub keycode: Value,
pub event: Value, pub event: Value,