|
|
@ -4386,14 +4386,15 @@ fn match_brackets(cx: &mut Context) {
|
|
|
|
let (view, doc) = current!(cx.editor);
|
|
|
|
let (view, doc) = current!(cx.editor);
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(syntax) = doc.syntax() {
|
|
|
|
if let Some(syntax) = doc.syntax() {
|
|
|
|
let pos = doc
|
|
|
|
let text = doc.text().slice(..);
|
|
|
|
.selection(view.id)
|
|
|
|
let selection = doc.selection(view.id).clone().transform(|range| {
|
|
|
|
.primary()
|
|
|
|
if let Some(pos) = match_brackets::find(syntax, doc.text(), range.anchor) {
|
|
|
|
.cursor(doc.text().slice(..));
|
|
|
|
range.put_cursor(text, pos, doc.mode == Mode::Select)
|
|
|
|
if let Some(pos) = match_brackets::find(syntax, doc.text(), pos) {
|
|
|
|
} else {
|
|
|
|
let selection = Selection::point(pos);
|
|
|
|
range
|
|
|
|
doc.set_selection(view.id, selection);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
doc.set_selection(view.id, selection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|