helix: Change f and t motions (#35216)

In vim and zed (vim and helix modes) typing "tx" will jump before the
next `x`, but typing it again won't do anything. But in helix the cursor
just jumps before the `x` after that. I added that in helix mode.
This also solves another small issue where the selection doesn't include
the first `x` after typing "fx" twice. And similarly after typing "Fx"
or "Tx" the selection should include the character that the motion
startet on.

Release Notes:

- helix: Fixed inconsistencies in the "f" and "t" motions
This commit is contained in:
fantacell
2025-08-14 13:04:07 -04:00
committed by GitHub
parent 20be133713
commit 9a2b7ef372
3 changed files with 162 additions and 144 deletions
+2 -1
View File
@@ -2639,7 +2639,8 @@ fn find_backward(
}
}
fn is_character_match(target: char, other: char, smartcase: bool) -> bool {
/// Returns true if one char is equal to the other or its uppercase variant (if smartcase is true).
pub fn is_character_match(target: char, other: char, smartcase: bool) -> bool {
if smartcase {
if target.is_uppercase() {
target == other