@@ -4386,14 +4386,15 @@ fn match_brackets(cx: &mut Context) {
4386 let (view, doc) = current!(cx.editor);
4386 let (view, doc) = current!(cx.editor);
4388 if let Some(syntax) = doc.syntax() {
4388 if let Some(syntax) = doc.syntax() {
4390− .selection(view.id)
4392− .cursor(doc.text().slice(..));
4389+ let text = doc.text().slice(..);
4390+ let selection = doc.selection(view.id).clone().transform(|range| {
4393− if let Some(pos) = match_brackets::find(syntax, doc.text(), pos) {
4391+ if let Some(pos) = match_brackets::find(syntax, doc.text(), range.anchor) {
4394− let selection = Selection::point(pos);
4392+ range.put_cursor(text, pos, doc.mode == Mode::Select)
4395− doc.set_selection(view.id, selection);
4397+ doc.set_selection(view.id, selection);