mirror of https://github.com/helix-editor/helix
Match in visual use head not anchor (#1805)
Currently match is finding the match based on the anchor rather than the head (cursor) so this behavior is rather unexpected when user is doing a match but a different item was matched instead when the selection is more than one character.pull/1811/head^2
parent
43fc073cb3
commit
3d76fa0b81
|
@ -3702,7 +3702,7 @@ fn match_brackets(cx: &mut Context) {
|
||||||
let text = doc.text().slice(..);
|
let text = doc.text().slice(..);
|
||||||
let selection = doc.selection(view.id).clone().transform(|range| {
|
let selection = doc.selection(view.id).clone().transform(|range| {
|
||||||
if let Some(pos) =
|
if let Some(pos) =
|
||||||
match_brackets::find_matching_bracket_fuzzy(syntax, doc.text(), range.anchor)
|
match_brackets::find_matching_bracket_fuzzy(syntax, doc.text(), range.cursor(text))
|
||||||
{
|
{
|
||||||
range.put_cursor(text, pos, doc.mode == Mode::Select)
|
range.put_cursor(text, pos, doc.mode == Mode::Select)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue