aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorJakub Bartodziej2021-06-03 12:51:13 +0000
committerBlaž Hrastnik2021-06-03 14:23:23 +0000
commit6cbc0aea926248f029ab3868d5ed9b8d5a4f207f (patch)
tree6e6cdc66786370fda46aaec590cc3ee79c71bbb6 /helix-term/src
parentc1c3750d3801558bb9e6722e67d724b480a4cffa (diff)
Disable deleting from an empty buffer which can cause a crash.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 7b30168a..8d3e31e2 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -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)