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: problems with input `\_<foo\_>` #298

Closed
zhaojiangbin opened this Issue Nov 22, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@zhaojiangbin

zhaojiangbin commented Nov 22, 2015

To reproduce it:

  1. Copy and paste the following into the scratch buffer, change the major mode to C++:
void g(int);
void g(int*);
void g(int,
       int*);
void g(int&,
       int);
void g(int,
       int*,
       int&);
void f(int one) {
    g(one);
    g(&one);
    g(one,
      &one);
    if (one>0
        &&(one+5)
        ==(one*2)) {
        g(one
          ,one);
    if (one<0)
        g(one,
          &one,
          one);
}
template <typename T> class C;
void g(C<int> arg);
  1. Move cursor to the first line, run swiper, then type \_<one\_> as the input.
  2. In the first screenshot below, see how there are 14 lines (from line 10 to line 23) highlighted in the scratch buffer while there are only 7 candidates listed in the minibuffer.
  3. Press C-n and C-p, swiper only visits the 7 lines in scratch buffer that are candidates. The other 7 highlighted lines are skipped over.
  4. Change the input to \_<int\_>.
  5. In the second screenshot below, see how there are 11 lines (line 1 to line 10, and line 26) highlighted in the scratch buffer while there are only 5 candidates listed in the minibuffer.
  6. Press M-q to start replacing the matches. Type in anything other than "int" as the replacement, followed by RET.
  7. Now watch swiper visiting all the 11 highlighted occurrences in buffer and replacing them as expected.

It appears that, for the pattern \_<K\_>, if an occurrence K in buffer adjoins some punctuation characters such as +, *, &, < and > (there might be more) on either or both sides, swiper can find and highlight the occurrence in buffer but somehow cannot add the match to candidate list. In comparison, isearch-forward-regexp is able to highlight and visit all of them as expected. And occurrences adjoining characters such as (, ), , (there might be more) are found and listed correctly.

There is more.

  1. Move the cursor to line 6 which swiper does find and add to candidate list.
  2. Run swiper and give input \_<int\_>.
  3. Watch the cursor jumping to the line 1 instead of staying at line 6.

It works as expected when the input pattern is \bK\b, \<K\>, or just K.

screen shot 2015-11-21 at 7 40 34 pm
screen shot 2015-11-21 at 8 21 05 pm

@abo-abo abo-abo closed this in ce6ab7a Nov 22, 2015

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Nov 22, 2015

Owner

Thanks a lot for the thorough testing and bug report. The issue should be fixed now, but please make sure.

Owner

abo-abo commented Nov 22, 2015

Thanks a lot for the thorough testing and bug report. The issue should be fixed now, but please make sure.

@zhaojiangbin

This comment has been minimized.

Show comment
Hide comment
@zhaojiangbin

zhaojiangbin Nov 22, 2015

Verified. Appreciate the very quick response.

zhaojiangbin commented Nov 22, 2015

Verified. Appreciate the very quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment