sunnyranjan12 / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Too much text yanked with ygn #295

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. gvim -N -u NONE -i NONE
2. Enter test text:

a:1564
b:490

a:1
b:1

a:17
b:17

3. Place cursor on empty line prior to "a:1"
4. Search for pattern /a:0\@!\zs\d\+
5. ygn

I expect the single number "1" to be copied. Instead, after "ygn" I get message 
"4 lines yanked" and register 0 contains these four lines:

1
b:1

a:17

What version of the product are you using? On what operating system?

gvim 7.4.527 64-bit on Windows 7, HUGE feature set.

Original issue reported on code.google.com by fritzoph...@gmail.com on 8 Dec 2014 at 5:06

GoogleCodeExporter commented 9 years ago
Oh, good catch. The problem is, the is_one_char() test depends on the first 
match and in your case it is not 1 char wide but more (but the actual second 
match we care about, is only one char wide). So here is a patch, that checks 
one more time for the width of the next match.

Original comment by chrisbr...@googlemail.com on 8 Dec 2014 at 7:13

Attachments:

GoogleCodeExporter commented 9 years ago
I confirm this fixes the issue. Thanks!

Original comment by fritzoph...@gmail.com on 8 Dec 2014 at 7:30

GoogleCodeExporter commented 9 years ago
I'm looking at the patch, and I see you adapted the reported issue for the new 
test, so I'll mention now that I was able to simplify the pattern slightly. You 
already had a patch before I had a chance to post it.

You can omit the "0\@!" and ygn was still grabbing too much. I.e. searching for 
this failed prior to the patch:

    a:\zs\d\+

That's about as simple as I could make it. FYI, in case you wanted to update 
the test with a simpler pattern.

Original comment by fritzoph...@gmail.com on 8 Dec 2014 at 7:36

GoogleCodeExporter commented 9 years ago
Fixed by 7.4.551

Original comment by chrisbr...@googlemail.com on 13 Dec 2014 at 10:21