Wednesday, February 3, 2016

Re: Feature or bug? dw oddities

Elmar Hinz <t3elmar@googlemail.com> writes:
> Hello,
>
> I am working on a Python clone of vim, which requires to inspect Vim
> behaviour in detail. Some behaviour looks odd and I like to know if it
> is a bug or what is the reasoning of that behaviour. This is my first
> observation:
>
> Given, cursor on first x:
>
> xxx
> xxx
> xxx
>
> Now hitting 1dw deletes zero line breaks, while 2dw deletes two line breaks.
>
> Feature or bug?

Some interesting information:

1. Other vi implementations differ on how they behave here:

- Elvis behaves the same way.

- Heirloom vi behaves the same way. But *crashes* on some operating
systems if asked to do this (it works on Ubuntu, but not Mac OSX,
for me).

- Most other vi implementations (nvi, vile, and Emacs' evil and viper
modes) do not behave this way.

2. 2cw does _not_ delete the second linebreak, in any tested editor.

3. The POSIX vi standard specifies some distinction between 2cw and 2dw:

- If there are <blank> characters or an end-of-line that precede the
countth bigword, and the associated command is c, the region of
text shall be up to and including the last character before the
preceding <blank> characters or end-of-line.

- If there are <blank> characters or an end-of-line that precede the
bigword, and the associated command is d or y, the region of text
shall be up to and including the last <blank> before the start of
the bigword or end-of-line.

(Reference to "bigwords" are because this is actually the description
of the W command.)

I _think_ that this is _not_ intended to imply vim's behavior, since
the end-of-line is, at least in context, not a <blank>.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment