Bug: Arbitrary number of counts and "motion force"

87 views
Skip to first unread message

glts

unread,
Mar 19, 2013, 3:46:23 PM3/19/13
to vim...@vim.org
It is possible to give an arbitrary number of counts and "motion force"
(v V <C-V>) after an operator.

For example, in the current Vim 7.3.874, the following is a valid normal
mode command:

d2v45V108v3<C-V>8j

This doesn't make any sense. I think Vim should beep and abort in these
cases, as it does for other invalid command combinations.

David Bürgin

Christian Brabandt

unread,
Mar 19, 2013, 6:02:19 PM3/19/13
to vim...@vim.org
Hi glts!
This patch fixes it.

regards,
Christian
--
Heucheln, das Wort klingt schlecht, drum nennt man es Takt.
-- Carl Spittler
op_motion_force.diff

glts

unread,
Mar 19, 2013, 6:13:01 PM3/19/13
to vim...@vim.org
Hi Christian

On Tuesday, March 19, 2013 11:02:19 PM UTC+1, Christian Brabandt wrote:
> This patch fixes it.

No, it's not that simple. Try "5d2V34e".

Christian Brabandt

unread,
Mar 19, 2013, 6:23:36 PM3/19/13
to vim...@vim.org
Hi glts!

On Di, 19 M�r 2013, glts wrote:

Hm, I am not sure, this is really invalid and it is hard to draw the
line when it should be discarded.

regards,
Christian
--
Der vern�nftige Mensch pa�t sich der Welt an; der unvern�nftige
besteht auf dem Versuch, die Welt sich anzupassen. Deshalb h�ngt aller
Fortschritt vom unvern�nftigen Menschen ab.
-- George Bernard Shaw

Bram Moolenaar

unread,
Mar 20, 2013, 4:23:57 PM3/20/13
to Christian Brabandt, vim...@vim.org

Christian Brabandt wrote:

> Hi glts!
>
> On Di, 19 M=E4r 2013, glts wrote:
>
> > It is possible to give an arbitrary number of counts and "motion force"
> > (v V <C-V>) after an operator.
> >=20
> > For example, in the current Vim 7.3.874, the following is a valid normal
> > mode command:
> >=20
> > d2v45V108v3<C-V>8j
> >=20
> > This doesn't make any sense. I think Vim should beep and abort in these
> > cases, as it does for other invalid command combinations.
>
> This patch fixes it.

I'm not sure giving an error is better than to lust let it happen.
A mix of "v" and "V" should at least be allowed, one can change its
mind.


--
hundred-and-one symptoms of being an internet addict:
88. Every single time you press the 'Get mail' button...it does get new mail.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Mar 20, 2013, 4:45:26 PM3/20/13
to vim...@vim.org
Hi Bram!

On Mi, 20 M�r 2013, Bram Moolenaar wrote:

>
> Christian Brabandt wrote:
>
> > Hi glts!
> >
> > On Di, 19 M=E4r 2013, glts wrote:
> >
> > > It is possible to give an arbitrary number of counts and "motion force"
> > > (v V <C-V>) after an operator.
> > >=20
> > > For example, in the current Vim 7.3.874, the following is a valid normal
> > > mode command:
> > >=20
> > > d2v45V108v3<C-V>8j
> > >=20
> > > This doesn't make any sense. I think Vim should beep and abort in these
> > > cases, as it does for other invalid command combinations.
> >
> > This patch fixes it.
>
> I'm not sure giving an error is better than to lust let it happen.
> A mix of "v" and "V" should at least be allowed, one can change its
> mind.

Indeed. The patch only clears it, if both a count and v/V/Ctrl-V has
been given.

Mit freundlichen Gr��en
Christian
--
Leute, die selber Zwiebeln essen, k�nnen nicht gut beurteilen, ob
andere Zwiebeln gegessen haben oder nicht.
-- Thornton Niven Wilder
Reply all
Reply to author
Forward
0 new messages