Fix jank in LSP debug log autoscroll (#22998)
Not sure why scroll was janky with `Autoscroll::newest()`, but this appears to fix it. Probably better to conditionally do the autoscroll requests anyway. Release Notes: - N/A
This commit is contained in:
parent
bbbd1e9902
commit
b65dc8c566
2 changed files with 12 additions and 1 deletions
|
@ -642,6 +642,8 @@ impl LspLogView {
|
|||
log_view.editor.update(cx, |editor, cx| {
|
||||
editor.set_read_only(false);
|
||||
let last_point = editor.buffer().read(cx).len(cx);
|
||||
let newest_cursor_is_at_end =
|
||||
editor.selections.newest::<usize>(cx).start >= last_point;
|
||||
editor.edit(
|
||||
vec![
|
||||
(last_point..last_point, entry.trim()),
|
||||
|
@ -657,7 +659,10 @@ impl LspLogView {
|
|||
cx,
|
||||
);
|
||||
}
|
||||
editor.request_autoscroll(Autoscroll::fit(), cx);
|
||||
|
||||
if newest_cursor_is_at_end {
|
||||
editor.request_autoscroll(Autoscroll::bottom(), cx);
|
||||
}
|
||||
editor.set_read_only(true);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue