mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-12-01 11:23:10 +03:00
Disable deleting from an empty buffer which can cause a crash.
This commit is contained in:
parent
c1c3750d38
commit
6cbc0aea92
@ -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
|
// heuristic: append changes to history after each command, unless we're in insert mode
|
||||||
|
|
||||||
fn _delete_selection(doc: &mut Document, view_id: ViewId) {
|
fn _delete_selection(doc: &mut Document, view_id: ViewId) {
|
||||||
|
if doc.empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// first yank the selection
|
// first yank the selection
|
||||||
let values: Vec<String> = doc
|
let values: Vec<String> = doc
|
||||||
.selection(view_id)
|
.selection(view_id)
|
||||||
|
@ -494,6 +494,10 @@ impl Document {
|
|||||||
pub fn versioned_identifier(&self) -> lsp::VersionedTextDocumentIdentifier {
|
pub fn versioned_identifier(&self) -> lsp::VersionedTextDocumentIdentifier {
|
||||||
lsp::VersionedTextDocumentIdentifier::new(self.url().unwrap(), self.version)
|
lsp::VersionedTextDocumentIdentifier::new(self.url().unwrap(), self.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn empty(&self) -> bool {
|
||||||
|
self.text == "\n"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user