From 8fd20678617cc6c226c32783e00132631a699ec1 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 7 Feb 2025 13:59:32 -0500 Subject: [PATCH] Revert "edit prediction: Fix jump cursor position when scrolled (#24230)" This reverts commit bc67f990ae374a96e81ab5e1afa8540a9bf1c13a. --- crates/editor/src/editor.rs | 9 ++------- crates/editor/src/element.rs | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 49e47865232246af0256af4b47fc35bb10e487a6..56666e00a4bd5047580ef3adbb62f9faf9c4ef7a 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -5418,7 +5418,6 @@ impl Editor { min_width: Pixels, max_width: Pixels, cursor_point: Point, - start_row: DisplayRow, line_layouts: &[LineWithInvisibles], style: &EditorStyle, accept_keystroke: &gpui::Keystroke, @@ -5471,7 +5470,6 @@ impl Editor { Some(completion) => self.render_edit_prediction_cursor_popover_preview( completion, cursor_point, - start_row, line_layouts, style, cx, @@ -5481,7 +5479,6 @@ impl Editor { Some(stale_completion) => self.render_edit_prediction_cursor_popover_preview( stale_completion, cursor_point, - start_row, line_layouts, style, cx, @@ -5568,7 +5565,6 @@ impl Editor { &self, completion: &InlineCompletionState, cursor_point: Point, - start_row: DisplayRow, line_layouts: &[LineWithInvisibles], style: &EditorStyle, cx: &mut Context, @@ -5676,9 +5672,8 @@ impl Editor { let end_point = range_around_target.end.to_point(&snapshot); let target_point = target.text_anchor.to_point(&snapshot); - let cursor_relative_position = line_layouts - .get(start_point.row.saturating_sub(start_row.0) as usize) - .map(|line| { + let cursor_relative_position = + line_layouts.get(start_point.row as usize).map(|line| { let start_column_x = line.x_for_index(start_point.column as usize); let target_column_x = line.x_for_index(target_point.column as usize); target_column_x - start_column_x diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 961fe750ce5586c25f7cbec6dc0138b962fbc171..4b57f8654495ce8f7b676ee50f8822bd9bbb76bd 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -3300,7 +3300,6 @@ impl EditorElement { min_width, max_width, cursor_point, - start_row, &line_layouts, style, accept_keystroke.as_ref()?,