Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeat find char motion and fix a motion bug #891

Merged
merged 1 commit into from
Oct 24, 2021

Conversation

cossonleo
Copy link
Contributor

Implement repeat find motion (find_till_char, find_next_char, extend_till_char, extend_next_char and pre {find,extend})

Fix a bug find till motion works unexpect when the next char of cursor equals searching char.

simplescreenrecorder1-2021-10-22_14.08.05.mp4

helix-term/src/keymap.rs Outdated Show resolved Hide resolved
helix-term/src/commands.rs Outdated Show resolved Hide resolved
@archseer
Copy link
Member

Can you also make it work for ma mi commands? (mi( etc.)

I mentioned this in the conversation above.

@cossonleo
Copy link
Contributor Author

Can you also make it work for ma mi commands? (mi( etc.)

I mentioned this in the conversation above.

@archseer

I had added.

@archseer
Copy link
Member

Looks good! I think you need a git rebase, there's some commits in there from master: https://github.com/helix-editor/helix/pull/891/files

@cossonleo
Copy link
Contributor Author

Looks good! I think you need a git rebase, there's some commits in there from master: https://github.com/helix-editor/helix/pull/891/files

fixed

Comment on lines +768 to +771
let n = match text.get_char(pos) {
Some(next_ch) if next_ch == ch => n + 1,
_ => n,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the bug here?

te|xt text -> tx -> te|xt text

instead of

te|xt text -> tx -> text te|xt?

This is actually normal behavior in neovim/kakoune:

https://asciinema.org/a/mB7x2a1PguaIesmqLH5gBsSaV

I'm pressing tf tf tf tf.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But maybe this is better. If I'm pressing tx I probably don't want to match x right after the cursor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cursor will not move with repeat motion.Personly most time I feel it is strange.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants