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

swiper: ivy-yank-word less useful when there are multiple matches in the current line #314

Closed
zhaojiangbin opened this issue Dec 4, 2015 · 4 comments

Comments

@zhaojiangbin
Copy link

@zhaojiangbin zhaojiangbin commented Dec 4, 2015

Reproduction:
1- In scratch buffer enter the following line:

Some_type v = Some_func();

2- Place the cursor on the second 'S' - one that following the '='.
3- Run swiper, press C-w to yank the word "Some" (or type in the word "Some").
4- Watch the point jumping to the first occurrence of "Some".
5- It is now unable to yank the word "_func".

With case folded, this can happen even more often in C and C++ code.

There is a workaround: at the prompt type "_f", instead of pressing C-w again in step 5. It is less convenient though.

@abo-abo abo-abo closed this in ed9169d Dec 4, 2015
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Dec 4, 2015

Thanks.

@zhaojiangbin
Copy link
Author

@zhaojiangbin zhaojiangbin commented Dec 12, 2015

Well, the change does fix the issue for M-j (or whatever key that ivy-yank-word is mapped to) .

But the point still jumps to the first match when either the pattern "Some" is entered manually on prompt or swiper is called with a non-nil initial input such as M-:(swiper "Some"). Subsequently, ivy-yank-word is made unable to pick up the wanted word.

abo-abo added a commit that referenced this issue Dec 12, 2015
* swiper.el (swiper--current-line):
(swiper--current-match-start): New defvar.
(swiper--init): Update.
(swiper--update-input-ivy): Don't move to line NUM if
`swiper--current-line' is equal to NUM. Later, store NUM in
`swiper--current-line' to avoid calling `line-number-at-pos'.
Additionally store `swiper--current-match-start' - it's necessary to
move there before searching for the regexp, since the point currently is
after the old regexp.

Fixes #314
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Dec 12, 2015

Thanks, please test. In the future, if you find that I closed an issue opened by you, and the issue isn't solved, please re-open it. If the issue isn't tracked by Github, I'll likely forget about it.

@zhaojiangbin
Copy link
Author

@zhaojiangbin zhaojiangbin commented Dec 12, 2015

Verified. Thanks very much.

I don't have the privilege of re-opening closed issues even opened by myself. :) In the future I can open a new issue and refer the old one in it.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.