Empty last selection on cancel

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-05-10 17:09:39 +02:00
parent 143c50f321
commit acbda9184e

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);
}
}