Christian wrote:

> On Di, 17 Sep 2019, Bram Moolenaar wrote:
> 
> > Patch 8.1.2052
> > Problem:    Using "x" before a closed fold may delete that fold.
> > Solution:   Do not translate 'x' do "dl". (Christian Brabandt, closes #4927)
> > Files:          src/normal.c, src/testdir/test_fold.vim
> 
> Quoting from the related issue:
> 
> > Thanks.  But the line should still be deleted, thus in this case the
> > translated operation is "dd".
> 
> I am not sure I agree.
> 
> I did intentionally not delete the line. My idea was, that `x` on an
> empty line (or after a newline [e.g. with `:set
> virtualedit=onemore`]) should be a no-op and the `whichwrap` option 
> should not apply to it, since the user did not type `dl`.

I thought we only needed to avoid deleting the following fold and not
change anything else.  But now I read this comment in the help for
'whichwrap':

        When 'l' is included and it is used after an operator at the end of a
        line then it will not move to the next line.  This makes "dl", "cl",
        "yl" etc. work normally.

This would apply since "x" is equivalent to "dl".  However, if you try
"dl" on an empty line, it does delete the line break.  It's like the
cursor is on top of the line break, so that gets deleted.
 
> And because there is no character after the cursor I think that `x` 
> should not do anything (just like `x` on an empty line with a default 
> whichwrap setting).
> 
> In fact, the new behaviour will now delete a line, e.g. with
> 
> :set ww+=l virtualedit=onemore list listchars=eol:$
> 
> one a line like this and the cursor on the End-of-line marker ($):
> 
>     abcd$
> 
> pressing x on this will now delete the line and this is rather unexpected.
> 
> In fact, if we are going to translate `x` to `dd` in that case, we 
> probably should do the same for `X` when `h` is in whichwrap.
> 
> But I still think this is wrong.
> 
> What do you think? I can make a patch either way.

Let's be practical: We fixed something because a user complained and it
was clear it had to be fixed.  For "x" deleting a line we did not get
complaints.  And, depending on how you look at it, if "l" crosses line
boundaries, it makes sense that "x" does too.  Think of editing a
paragraph with wrapped lines, then repeating "x" should not get stuck
when the line gets empty.

-- 
Facepalm statement #5: "Petrol getting more expensive?  Not for me, I'm always
tanking for 20 dollars"

 /// Bram Moolenaar -- b...@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    ///

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/201909181132.x8IBWPo5016126%40masaka.moolenaar.net.

Raspunde prin e-mail lui