Merge pull request #1494 from zed-industries/do-not-scroll-when-saving

Don't scroll to cursor when performing file save
This commit is contained in:
Julia 2022-08-12 11:28:01 -04:00 committed by GitHub
commit 61684e693f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -397,7 +397,7 @@ impl Item for Editor {
let buffers = buffer.read(cx).all_buffers();
let mut timeout = cx.background().timer(FORMAT_TIMEOUT).fuse();
let format = project.update(cx, |project, cx| project.format(buffers, true, cx));
cx.spawn(|this, mut cx| async move {
cx.spawn(|_, mut cx| async move {
let transaction = futures::select_biased! {
_ = timeout => {
log::warn!("timed out waiting for formatting");
@ -406,9 +406,6 @@ impl Item for Editor {
transaction = format.log_err().fuse() => transaction,
};
this.update(&mut cx, |editor, cx| {
editor.request_autoscroll(Autoscroll::Fit, cx)
});
buffer
.update(&mut cx, |buffer, cx| {
if let Some(transaction) = transaction {