Compare commits

...

4 Commits

Author SHA1 Message Date
dino
eb97698d31 refactor: new fix 2025-10-27 17:22:10 +00:00
dino
72184933bd chore: tentative fix
Remove the changes introduced in the previous commit and update the
`MessageEditor.confirm_mention_for_selection` method in order to request
autoscroll from the editor twice, one of them delayed, as this appears
to fix the scrolling issue, regardless of the number of cursors used.

I'm not yet entirely sure why this is the case, so further investigation
is probably warranted in order to actually understand if this is the
best fix we can do right now, and why.
2025-10-27 12:22:18 +00:00
Agus Zubiaga
1adce4d911 Checkpoint: Debugging 2025-10-15 13:31:17 -03:00
dino
24fde31b58 chore: start investigation 2025-10-15 16:02:06 +01:00
2 changed files with 16 additions and 8 deletions

View File

@@ -582,7 +582,7 @@ impl MessageEditor {
let crease_id = self.editor.update(cx, |editor, cx| {
let crease_ids = editor.insert_creases(vec![crease.clone()], cx);
editor.fold_creases(vec![crease], false, window, cx);
editor.fold_creases(vec![crease], true, window, cx);
crease_ids.first().copied().unwrap()
});
@@ -598,6 +598,15 @@ impl MessageEditor {
),
);
}
let editor = self.editor.clone();
cx.on_next_frame(window, move |_, window, cx| {
cx.on_next_frame(window, move |_, _, cx| {
editor.update(cx, |editor, cx| {
editor.request_autoscroll(editor::scroll::Autoscroll::fit(), cx);
});
});
});
}
fn confirm_mention_for_thread(
@@ -1365,7 +1374,7 @@ pub(crate) fn insert_crease_for_mention(
};
let ids = editor.insert_creases(vec![crease.clone()], cx);
editor.fold_creases(vec![crease], false, window, cx);
editor.fold_creases(vec![crease], true, window, cx);
Some(ids[0])
})?;

View File

@@ -157,11 +157,8 @@ impl Editor {
.to_display_point(&display_map)
.row()
.as_f64();
target_bottom = selections
.last()
.unwrap()
.head()
.to_display_point(&display_map)
target_bottom = display_map
.point_to_display_point(selections.last().unwrap().head(), text::Bias::Left)
.row()
.next_row()
.as_f64();
@@ -229,7 +226,9 @@ impl Editor {
if needs_scroll_up && !needs_scroll_down {
scroll_position.y = target_top;
} else if !needs_scroll_up && needs_scroll_down {
scroll_position.y = target_bottom - visible_lines;
dbg!(scroll_position.y);
scroll_position.y = dbg!(target_bottom) - dbg!(visible_lines);
dbg!(scroll_position.y);
}
if needs_scroll_up ^ needs_scroll_down {