diff --git a/helix-core/src/match_brackets.rs b/helix-core/src/match_brackets.rs index 6f8997e5..e1e40e0d 100644 --- a/helix-core/src/match_brackets.rs +++ b/helix-core/src/match_brackets.rs @@ -93,7 +93,7 @@ fn find_pair( if let (Some((start_pos, open)), Some((end_pos, close))) = (as_char(doc, &open), as_char(doc, &close)) { - if PAIRS.contains(&(open, close)) { + if PAIRS.contains(&(open, close)) && start_pos <= pos_ && pos_ <= end_pos { if end_pos == pos_ { return Some(start_pos); }