@@ -3770,12 +3770,15 @@ fn expand_selection(cx: &mut Context) {
37703770 let text = doc.text().slice(..);
37713771
37723772 let current_selection = doc.selection(view.id);
3773+ let selection = object::expand_selection(syntax, text, current_selection.clone());
37733774
3774− // save current selection so it can be restored using shrink_selection
3775− view.object_selections.push(current_selection.clone());
3775+ // check if selection is different from the last one
3776+ if *current_selection != selection {
3777+ // save current selection so it can be restored using shrink_selection
3778+ view.object_selections.push(current_selection.clone());
37763779
3777− let selection = object::expand_selection(syntax, text, current_selection.clone());
3778− doc.set_selection(view.id, selection);
3780+ doc.set_selection(view.id, selection);
3781+ }
37793782 }
37803783 };
37813784 motion(cx.editor);