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

Antonio Scandurra created

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.

Change summary

crates/editor/src/editor.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Detailed changes

crates/editor/src/editor.rs 🔗

@@ -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<_>>()