|
|
@ -78,6 +78,7 @@ pub struct KeyMapApi {
|
|
|
|
string_to_embedded_keymap: fn(String) -> EmbeddedKeyMap,
|
|
|
|
string_to_embedded_keymap: fn(String) -> EmbeddedKeyMap,
|
|
|
|
merge_keybindings: fn(&mut EmbeddedKeyMap, EmbeddedKeyMap),
|
|
|
|
merge_keybindings: fn(&mut EmbeddedKeyMap, EmbeddedKeyMap),
|
|
|
|
is_keymap: fn(SteelVal) -> bool,
|
|
|
|
is_keymap: fn(SteelVal) -> bool,
|
|
|
|
|
|
|
|
deep_copy_keymap: fn(EmbeddedKeyMap) -> EmbeddedKeyMap,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl KeyMapApi {
|
|
|
|
impl KeyMapApi {
|
|
|
@ -89,6 +90,7 @@ impl KeyMapApi {
|
|
|
|
string_to_embedded_keymap,
|
|
|
|
string_to_embedded_keymap,
|
|
|
|
merge_keybindings,
|
|
|
|
merge_keybindings,
|
|
|
|
is_keymap,
|
|
|
|
is_keymap,
|
|
|
|
|
|
|
|
deep_copy_keymap,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -117,6 +119,8 @@ fn load_keymap_api(engine: &mut Engine, api: KeyMapApi) {
|
|
|
|
module.register_fn("helix-string->keymap", api.string_to_embedded_keymap);
|
|
|
|
module.register_fn("helix-string->keymap", api.string_to_embedded_keymap);
|
|
|
|
module.register_fn("keymap?", api.is_keymap);
|
|
|
|
module.register_fn("keymap?", api.is_keymap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.register_fn("helix-deep-copy-keymap", api.deep_copy_keymap);
|
|
|
|
|
|
|
|
|
|
|
|
// This should be associated with a corresponding scheme module to wrap this up
|
|
|
|
// This should be associated with a corresponding scheme module to wrap this up
|
|
|
|
module.register_value(
|
|
|
|
module.register_value(
|
|
|
|
"*buffer-or-extension-keybindings*",
|
|
|
|
"*buffer-or-extension-keybindings*",
|
|
|
@ -534,6 +538,11 @@ pub fn get_keymap() -> EmbeddedKeyMap {
|
|
|
|
EmbeddedKeyMap(map)
|
|
|
|
EmbeddedKeyMap(map)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Will deep copy a value by default when using a value type
|
|
|
|
|
|
|
|
pub fn deep_copy_keymap(copied: EmbeddedKeyMap) -> EmbeddedKeyMap {
|
|
|
|
|
|
|
|
copied
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Base level - no configuration
|
|
|
|
// Base level - no configuration
|
|
|
|
pub fn default_keymap() -> EmbeddedKeyMap {
|
|
|
|
pub fn default_keymap() -> EmbeddedKeyMap {
|
|
|
|
EmbeddedKeyMap(keymap::default())
|
|
|
|
EmbeddedKeyMap(keymap::default())
|
|
|
|