Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ui: Fix Vim mode detection in keybinding to text helpers (#38971)
Bartosz Kaszubowskia55dff78342c
diff --git a/crates/ui/src/components/keybinding.rs b/crates/ui/src/components/keybinding.rsindex 76bd128ed80..f8ac85528ec 100644--- a/crates/ui/src/components/keybinding.rs+++ b/crates/ui/src/components/keybinding.rs@@ -392,7 +392,7 @@ pub fn text_for_action(action: &dyn Action, window: &Window, cx: &App) -> Optionpub fn text_for_keystrokes(keystrokes: &[Keystroke], cx: &App) -> String {let platform_style = PlatformStyle::platform();- let vim_enabled = cx.try_global::<VimStyle>().is_some();+ let vim_enabled = KeyBinding::is_vim_mode(cx);keystrokes.iter().map(|keystroke| {@@ -408,7 +408,7 @@ pub fn text_for_keystrokes(keystrokes: &[Keystroke], cx: &App) -> String {pub fn text_for_keybinding_keystrokes(keystrokes: &[KeybindingKeystroke], cx: &App) -> String {let platform_style = PlatformStyle::platform();- let vim_enabled = cx.try_global::<VimStyle>().is_some();+ let vim_enabled = KeyBinding::is_vim_mode(cx);keystrokes.iter().map(|keystroke| {@@ -424,8 +424,7 @@ pub fn text_for_keybinding_keystrokes(keystrokes: &[KeybindingKeystroke], cx: &Apub fn text_for_keystroke(modifiers: &Modifiers, key: &str, cx: &App) -> String {let platform_style = PlatformStyle::platform();- let vim_enabled = cx.try_global::<VimStyle>().is_some();- keystroke_text(modifiers, key, platform_style, vim_enabled)+ keystroke_text(modifiers, key, platform_style, KeyBinding::is_vim_mode(cx))}/// Returns a textual representation of the given [`Keystroke`].