Retain selection's head (as opposed to its end) on insertion

This makes a difference when an edit spans two excerpts and the selection
start won't necessarily be the same as the selection end after the edit.
This commit is contained in:
Antonio Scandurra 2023-06-06 10:12:15 +02:00
parent 23836eb251
commit e46d1549d6

View File

@ -2382,7 +2382,7 @@ impl Editor {
old_selections
.iter()
.map(|s| {
let anchor = snapshot.anchor_after(s.end);
let anchor = snapshot.anchor_after(s.head());
s.map(|_| anchor)
})
.collect::<Vec<_>>()