proteanthread / vim

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

Starting line-wise visual mode with a count ('[count]V') usually selects a wrong number of lines #176

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

---
1. Start Vim and fill in a buffer with 5 lines or more.
2. Go to the first line and type '2Vy'. It behaves as expected.
3. Type '2V' again.

What is the expected output? What do you see instead?

---
I expect the first 2 lines be selected.  Instead, the first 4 are selected.

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

---
Vim 7.4.52 on Mac OS 10.9

Please provide any additional information below.

---
It looks at first like that the number of line selected with '[count]V' is 
[count] times the number of lines previously "yanked".  I am not sure if this 
rule is completely accurate, it seems i was also getting other numbers of lines 
selected, not sure.

Original issue reported on code.google.com by alexey.m...@gmail.com on 2 Nov 2013 at 9:21

GoogleCodeExporter commented 9 years ago
Not a bug, it has always been like this.

This happens when you select something and then cancel the selection. The count 
is interpreted as a multiplicator applied to the size of the previous 
selection. I think there was a reason for this ... odd behaviour, but I don't 
remember now.

Doc at ":h v" (applies to V and ^V, too).

Original comment by 676c7...@gmail.com on 2 Nov 2013 at 10:33

GoogleCodeExporter commented 9 years ago
It's the other way around, sorry about that. The multiplication behaviour 
occurs after some operation has been carried out on the Visual selection, for 
example after "Vjd" or your "2Vy".

Original comment by 676c7...@gmail.com on 2 Nov 2013 at 11:14

GoogleCodeExporter commented 9 years ago
I see, this is indeed documented at ":h v", but not at ":h V".  In fact, it 
contradicts the documentation at ":h V".  Is "[count]V" identical to "[count]v"?

It is not true that this happens if you select something and cancel the 
selection: for me it happens with "2Vy2V", but not with "2V<Esc>2V".

If this operation is useful, can it be assigned to a different key combination? 
 "[count]gv" for example?

Original comment by alexey.m...@gmail.com on 2 Nov 2013 at 11:23

GoogleCodeExporter commented 9 years ago
By the way, this is a new behaviour: [count] can be used with V since 7.4.

Original comment by alexey.m...@gmail.com on 2 Nov 2013 at 8:43

GoogleCodeExporter commented 9 years ago

Original comment by chrisbr...@googlemail.com on 30 Sep 2014 at 9:05