diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 4f0b63120243851c7796108c583d828a7b41106a..a356a09dea14b5438497155964d6fde488912523 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -2248,15 +2248,21 @@ impl Editor { pub fn accept_edit_prediction_keybind( &self, + accept_partial: bool, window: &Window, cx: &App, ) -> AcceptEditPredictionBinding { let key_context = self.key_context_internal(true, window, cx); let in_conflict = self.edit_prediction_in_conflict(); + let bindings = if accept_partial { + window.bindings_for_action_in_context(&AcceptPartialEditPrediction, key_context) + } else { + window.bindings_for_action_in_context(&AcceptEditPrediction, key_context) + }; + AcceptEditPredictionBinding( - window - .bindings_for_action_in_context(&AcceptEditPrediction, key_context) + bindings .into_iter() .filter(|binding| { !in_conflict @@ -7119,12 +7125,25 @@ impl Editor { window: &mut Window, cx: &mut Context, ) { - let accept_keybind = self.accept_edit_prediction_keybind(window, cx); - let Some(accept_keystroke) = accept_keybind.keystroke() else { - return; + let mut modifiers_held = false; + if let Some(accept_keystroke) = self + .accept_edit_prediction_keybind(false, window, cx) + .keystroke() + { + modifiers_held = modifiers_held + || (&accept_keystroke.modifiers == modifiers + && accept_keystroke.modifiers.modified()); }; + if let Some(accept_partial_keystroke) = self + .accept_edit_prediction_keybind(true, window, cx) + .keystroke() + { + modifiers_held = modifiers_held + || (&accept_partial_keystroke.modifiers == modifiers + && accept_partial_keystroke.modifiers.modified()); + } - if &accept_keystroke.modifiers == modifiers && accept_keystroke.modifiers.modified() { + if modifiers_held { if matches!( self.edit_prediction_preview, EditPredictionPreview::Inactive { .. } @@ -8441,7 +8460,7 @@ impl Editor { window: &mut Window, cx: &App, ) -> Option { - let accept_binding = self.accept_edit_prediction_keybind(window, cx); + let accept_binding = self.accept_edit_prediction_keybind(false, window, cx); let accept_keystroke = accept_binding.keystroke()?; let is_platform_style_mac = PlatformStyle::platform() == PlatformStyle::Mac; diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index abe0f6aa7bd3f5958b30e6389dd8a1b82b1cccac..33371b5c6af02fd1d1c242f53463e2aef51a3071 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -3881,7 +3881,8 @@ impl EditorElement { let edit_prediction = if edit_prediction_popover_visible { self.editor.update(cx, move |editor, cx| { - let accept_binding = editor.accept_edit_prediction_keybind(window, cx); + let accept_binding = + editor.accept_edit_prediction_keybind(false, window, cx); let mut element = editor.render_edit_prediction_cursor_popover( min_width, max_width,