Hi Elmar!
On Do, 04 Feb 2016, Elmar Hinz wrote:
> On Thursday, February 4, 2016 at 6:31:03 AM UTC+1, Random832 wrote:
>
> > 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>.
>
>
> Thank you for the interesting input. I conclude you think the vim
> behaviour is at least disputable here. I keep this im mind for the
> future. For now I try to emulate Vim behaviour.
Where can I see your clone?
>
> Obviously this is an example of
>
> help: exclusive-linewise
>
> That can be proved with, with cursor on X:
>
> Xxx xxx xxx xxx
>
>
> With 2dw exclusive-likewise behaviour is used and the whitespace
> before X is deleted. With 1dw neither whitespace nor line-break are
> deleted.
I think, it is this part of the code from op_delete()
/*
* Imitate the strange Vi behaviour: If the delete spans more than one
* line and motion_type == MCHAR and the result is a blank line, make the
* delete linewise. Don't do this for the change command or Visual mode.
*/
if ( oap->motion_type == MCHAR
&& !oap->is_VIsual
&& !oap->block_mode
&& oap->line_count > 1
&& oap->motion_force == NUL
&& oap->op_type == OP_DELETE)
{
ptr = ml_get(oap->end.lnum) + oap->end.col;
if (*ptr != NUL)
ptr += oap->inclusive;
ptr = skipwhite(ptr);
if (*ptr == NUL && inindent(0))
oap->motion_type = MLINE;
}
So this seems to come from some old vi oddity.
Best,
Christian
--
Niemand ist ein ärgerer Feind des Christentums als das Christentum.
-- Hans-Hermann Kesten
--
--
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.
Thursday, February 4, 2016
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment