aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorDaniel S Poulin2022-08-17 01:41:59 +0000
committerGitHub2022-08-17 01:41:59 +0000
commit7711db3a3af8f7ca156c8c71ae4b7ea2dd02d96f (patch)
tree9df5ab28fc342f79cdb67c7b387b20dc27c57635 /helix-core/src
parent254d5589070b4b86e0352a78978761bba490c663 (diff)
Adjust `m` textobject description and minor code clarification (#3343)
* Update description of `m` textobject to its actual functionality Sometime recently the functionality of `m` was changed to match the nearest pair to the cursor, rather than the former functionality of matching the pair only if the cursor was on one of the brace characters directly. * Rename surround methods to reflect that they work on pairs The current naming suggests that they may work generally on any textobject, whereas their implementation really focuses on pairs. * Change description of m textobject to match actual functionality The current implementation of `m` no longer merely looks at the pair character the cursor is on, but actually will search for the pair (defined in helix-core/src/surround.rs) that encloses the cursor, and not the entire selection. * Accept suggested wording change Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Prefix pair surround for consistency Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/textobject.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/helix-core/src/textobject.rs b/helix-core/src/textobject.rs
index ee06bf47..76c6d103 100644
--- a/helix-core/src/textobject.rs
+++ b/helix-core/src/textobject.rs
@@ -198,26 +198,26 @@ pub fn textobject_paragraph(
Range::new(anchor, head)
}
-pub fn textobject_surround(
+pub fn textobject_pair_surround(
slice: RopeSlice,
range: Range,
textobject: TextObject,
ch: char,
count: usize,
) -> Range {
- textobject_surround_impl(slice, range, textobject, Some(ch), count)
+ textobject_pair_surround_impl(slice, range, textobject, Some(ch), count)
}
-pub fn textobject_surround_closest(
+pub fn textobject_pair_surround_closest(
slice: RopeSlice,
range: Range,
textobject: TextObject,
count: usize,
) -> Range {
- textobject_surround_impl(slice, range, textobject, None, count)
+ textobject_pair_surround_impl(slice, range, textobject, None, count)
}
-fn textobject_surround_impl(
+fn textobject_pair_surround_impl(
slice: RopeSlice,
range: Range,
textobject: TextObject,
@@ -562,7 +562,7 @@ mod test {
let slice = doc.slice(..);
for &case in scenario {
let (pos, objtype, expected_range, ch, count) = case;
- let result = textobject_surround(slice, Range::point(pos), objtype, ch, count);
+ let result = textobject_pair_surround(slice, Range::point(pos), objtype, ch, count);
assert_eq!(
result,
expected_range.into(),