diff --git a/helix-core/src/surround.rs b/helix-core/src/surround.rs index 2d4242b39..fada7c5c6 100644 --- a/helix-core/src/surround.rs +++ b/helix-core/src/surround.rs @@ -439,7 +439,7 @@ pub fn find_prev_tag( loop { let prev_char = match chars.prev() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos -= 1; @@ -448,7 +448,7 @@ pub fn find_prev_tag( loop { let current_char = match chars.prev() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos -= 1; if current_char == '<' { @@ -485,13 +485,13 @@ pub fn find_next_tag( loop { let next_char = match chars.next() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos += 1; if next_char == '<' { let char_after_that = match chars.next() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos += 1; if char_after_that == '/' { @@ -499,7 +499,7 @@ pub fn find_next_tag( loop { let current_char = match chars.next() { Some(ch) => ch, - None => return Err(Error::RangeExceedsText), + None => return Err(Error::PairNotFound), }; cursor_pos += 1; if is_valid_tagname_char(current_char) { @@ -665,7 +665,7 @@ mod test { } #[test] - fn test_find_surrounding_tag_with_imposter() { + fn test_find_surrounding_tag_with_extra_closing_tag() { let (doc, selection, expectations) = rope_with_selections_and_expectations_tags( "