Remove newest selection when adding a selection with a click count > 1
This prevents selections added in earlier clicks from being rendered under the pending selection.
This commit is contained in:
parent
73afb29b04
commit
bfecdb7bc0
1 changed files with 10 additions and 0 deletions
|
@ -751,6 +751,16 @@ impl Editor {
|
|||
|
||||
if !add {
|
||||
self.update_selections::<usize>(Vec::new(), false, cx);
|
||||
} else if click_count > 1 {
|
||||
// Remove the newest selection since it was only added as part of this multi-click.
|
||||
let newest_selection = self.newest_selection::<usize>(cx);
|
||||
self.update_selections::<usize>(
|
||||
self.selections(cx)
|
||||
.filter(|selection| selection.id != newest_selection.id)
|
||||
.collect(),
|
||||
false,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
self.pending_selection = Some(PendingSelection { selection, mode });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue