Skip to content

Commit

Permalink
Match in visual use head not anchor (#1805)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pickfire authored Mar 14, 2022
1 parent 43fc073 commit 3d76fa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3702,7 +3702,7 @@ fn match_brackets(cx: &mut Context) {
let text = doc.text().slice(..);
let selection = doc.selection(view.id).clone().transform(|range| {
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)
} else {
Expand Down

0 comments on commit 3d76fa0

Please sign in to comment.