Disable deleting from an empty buffer which can cause a crash.
This commit is contained in:
parent
c1c3750d38
commit
6cbc0aea92
2 changed files with 8 additions and 0 deletions
|
@ -745,6 +745,10 @@ pub fn extend_line(cx: &mut Context) {
|
|||
// heuristic: append changes to history after each command, unless we're in insert mode
|
||||
|
||||
fn _delete_selection(doc: &mut Document, view_id: ViewId) {
|
||||
if doc.empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// first yank the selection
|
||||
let values: Vec<String> = doc
|
||||
.selection(view_id)
|
||||
|
|
|
@ -494,6 +494,10 @@ impl Document {
|
|||
pub fn versioned_identifier(&self) -> lsp::VersionedTextDocumentIdentifier {
|
||||
lsp::VersionedTextDocumentIdentifier::new(self.url().unwrap(), self.version)
|
||||
}
|
||||
|
||||
pub fn empty(&self) -> bool {
|
||||
self.text == "\n"
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Reference in a new issue