Empty last selection on cancel

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-05-11 12:35:27 +02:00
co-authored by Nathan Sobo
parent 143c50f321
commit acbda9184e
+5 -1
View File
@@ -558,7 +558,11 @@ impl BufferView {
self.update_selections(vec![pending_selection], true, ctx);
}
} else {
let oldest_selection = selections.iter().min_by_key(|s| s.id).unwrap().clone();
let mut oldest_selection = selections.iter().min_by_key(|s| s.id).unwrap().clone();
if selections.len() == 1 {
oldest_selection.start = oldest_selection.head().clone();
oldest_selection.end = oldest_selection.head().clone();
}
self.update_selections(vec![oldest_selection], true, ctx);
}
}