Fix some visual bugs w/ edit predictions (#24591)

* correct the size of key binding icons
* avoid spurious modifier in 'jump to edit' popover when already
previewing
* fix height of the edit preview popover

Release Notes:

- N/A

Co-authored-by: agu-z <hi@aguz.me>
This commit is contained in:
Max Brunsfeld
2025-02-10 23:49:08 +00:00
committed by GitHub
co-authored by agu-z
parent dab9c41799
commit 929c5e76b4
6 changed files with 37 additions and 34 deletions
+2 -2
View File
@@ -5606,10 +5606,10 @@ impl Editor {
if provider.provider.needs_terms_acceptance(cx) {
return Some(
h_flex()
.h(self.edit_prediction_cursor_popover_height())
.min_w(min_width)
.flex_1()
.px_2()
.py_1()
.gap_3()
.elevation_2(cx)
.hover(|style| style.bg(cx.theme().colors().element_hover))
@@ -5699,11 +5699,11 @@ impl Editor {
Some(
h_flex()
.h(self.edit_prediction_cursor_popover_height())
.min_w(min_width)
.max_w(max_width)
.flex_1()
.px_2()
.py_1()
.elevation_2(cx)
.child(completion)
.child(ui::Divider::vertical())
+2 -12
View File
@@ -3560,13 +3560,11 @@ impl EditorElement {
match &active_inline_completion.completion {
InlineCompletion::Move { target, .. } => {
let previewing = false;
let target_display_point = target.to_display_point(editor_snapshot);
if target_display_point.row().as_f32() < scroll_top {
let mut element = inline_completion_accept_indicator(
"Jump to Edit",
Some(IconName::ArrowUp),
previewing,
editor,
window,
cx,
@@ -3579,7 +3577,6 @@ impl EditorElement {
let mut element = inline_completion_accept_indicator(
"Jump to Edit",
Some(IconName::ArrowDown),
previewing,
editor,
window,
cx,
@@ -3595,7 +3592,6 @@ impl EditorElement {
let mut element = inline_completion_accept_indicator(
"Jump to Edit",
None,
previewing,
editor,
window,
cx,
@@ -3658,12 +3654,7 @@ impl EditorElement {
let (mut element, origin) = self.editor.update(cx, |editor, cx| {
Some((
inline_completion_accept_indicator(
"Accept",
None,
editor.previewing_inline_completion,
editor,
window,
cx,
"Accept", None, editor, window, cx,
)?,
editor.display_to_pixel_point(
target_line_end,
@@ -5669,7 +5660,6 @@ fn header_jump_data(
fn inline_completion_accept_indicator(
label: impl Into<SharedString>,
icon: Option<IconName>,
previewing: bool,
editor: &Editor,
window: &mut Window,
cx: &App,
@@ -5683,7 +5673,7 @@ fn inline_completion_accept_indicator(
.text_size(TextSize::XSmall.rems(cx))
.text_color(cx.theme().colors().text)
.gap_1()
.when(!previewing, |parent| {
.when(!editor.previewing_inline_completion, |parent| {
parent.children(ui::render_modifiers(
&accept_keystroke.modifiers,
PlatformStyle::platform(),