Fix buffer restoration on ssh projects (#20215)
Closes #20143 Release Notes: - Remoting: Fixed a panic restoring unsaved untitled buffers over SSH
This commit is contained in:
parent
3856599853
commit
17b9d1976f
1 changed files with 6 additions and 3 deletions
|
@ -992,12 +992,15 @@ impl SerializableItem for Editor {
|
|||
};
|
||||
|
||||
// First create the empty buffer
|
||||
let buffer = project.update(&mut cx, |project, cx| {
|
||||
project.create_local_buffer("", language, cx)
|
||||
})?;
|
||||
let buffer = project
|
||||
.update(&mut cx, |project, cx| project.create_buffer(cx))?
|
||||
.await?;
|
||||
|
||||
// Then set the text so that the dirty bit is set correctly
|
||||
buffer.update(&mut cx, |buffer, cx| {
|
||||
if let Some(language) = language {
|
||||
buffer.set_language(Some(language), cx);
|
||||
}
|
||||
buffer.set_text(contents, cx);
|
||||
})?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue