Rework edit prediction preview mode (#24700)

Don't animate the cursor when previewing jumps.
Instead, display the jump popover with a line that resembles a cursor,
indicating the jump destination. If the jump destination is outside of
the view port, there is an extra step in which `tab` scrolls the
viewport to reveal the jump destination.

Release Notes:

- N/A

---------

Co-authored-by: danilo-leal <daniloleal09@gmail.com>
Co-authored-by: agu-z <hi@aguz.me>
This commit is contained in:
Max Brunsfeld 2025-02-11 15:14:12 -08:00 committed by GitHub
parent 5293f5724c
commit 148547ecd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 245 additions and 519 deletions

View file

@ -3,6 +3,7 @@ pub(crate) mod autoscroll;
pub(crate) mod scroll_amount;
use crate::editor_settings::{ScrollBeyondLastLine, ScrollbarAxes};
use crate::EditPredictionPreview;
use crate::{
display_map::{DisplaySnapshot, ToDisplayPoint},
hover_popover::hide_hover,
@ -495,6 +496,15 @@ impl Editor {
hide_hover(self, cx);
let workspace_id = self.workspace.as_ref().and_then(|workspace| workspace.1);
if let EditPredictionPreview::Active {
previous_scroll_position,
} = &mut self.edit_prediction_preview
{
if !autoscroll {
previous_scroll_position.take();
}
}
self.scroll_manager.set_scroll_position(
scroll_position,
&display_map,