summaryrefslogtreecommitdiff
path: root/helix-core/src/textobject.rs
diff options
context:
space:
mode:
authorGokul Soumya2022-02-11 03:31:52 +0000
committerBlaž Hrastnik2022-02-15 05:04:46 +0000
commitab2a0f325b906574698933824b381ed65c7482a3 (patch)
treee48dc274f88f14e79e695a27442d5b07a01e2a6b /helix-core/src/textobject.rs
parent989407f190d543154e33630b07f4a53d13798d72 (diff)
Add object.movement for tree-sitter navigation
Diffstat (limited to 'helix-core/src/textobject.rs')
-rw-r--r--helix-core/src/textobject.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-core/src/textobject.rs b/helix-core/src/textobject.rs
index 21ceec04..5a55a6f1 100644
--- a/helix-core/src/textobject.rs
+++ b/helix-core/src/textobject.rs
@@ -53,6 +53,8 @@ fn find_word_boundary(slice: RopeSlice, mut pos: usize, direction: Direction, lo
pub enum TextObject {
Around,
Inside,
+ /// Used for moving between objects.
+ Movement,
}
impl Display for TextObject {
@@ -60,6 +62,7 @@ impl Display for TextObject {
f.write_str(match self {
Self::Around => "around",
Self::Inside => "inside",
+ Self::Movement => "movement",
})
}
}
@@ -104,6 +107,7 @@ pub fn textobject_word(
Range::new(word_start - whitespace_count_left, word_end)
}
}
+ TextObject::Movement => unreachable!(),
}
}
@@ -118,6 +122,7 @@ pub fn textobject_surround(
.map(|(anchor, head)| match textobject {
TextObject::Inside => Range::new(next_grapheme_boundary(slice, anchor), head),
TextObject::Around => Range::new(anchor, next_grapheme_boundary(slice, head)),
+ TextObject::Movement => unreachable!(),
})
.unwrap_or(range)
}