From 3d76fa0b81c3f5cef7a8acdfa92b26004e610752 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Mon, 14 Mar 2022 10:45:22 +0800 Subject: 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.--- helix-term/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helix-term/src/commands.rs') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 1e4f68d0..fc5dc16d 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -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 { -- cgit v1.2.3-70-g09d2