On Mi, 18 Sep 2019, 'Andy Wokula' via vim_dev wrote:

> Am 17.09.2019 um 22:45 schrieb Bram Moolenaar:
> > 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
> 
> So it's ok when `dl' deletes that fold?
> 
> And `x' is documented to behave like `dl'.

No the patch fixes it and deletes only the line on which the cursor is.

But I think it creates another problem.

Take a file like this:

,----[ file.txt ]
| abc
| def
| ghi
`----

Now start Vim like this:

vim --clean -c ':set ww+=l virtualedit=onemore' -c 'norm! 1ggl'  file

The cursor is now after the content of line 1 ('_' being the cursor, ga 
returns 'NUL' on that position):

,----[ file.txt ]
| abc_
| def
| ghi
`----

Now press 'x' and you are left with:

,----[ file.txt ]
| def
| ghi
`----

And I think it is wrong in that 'x' deleted the first line (e.g. 
characters before the cursor position).

I think it should probably be:

,----
| abcdef
| ghi
`----

That is what this patch would do:

diff --git a/src/normal.c b/src/normal.c
index e83c4c0be..6afebd1ab 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -7404,7 +7404,7 @@ nv_optrans(cmdarg_T *cap)
            // whichwrap option, do not delete the next line.
            if (cap->cmdchar == 'x' && vim_strchr(p_ww, 'l') != NULL
                                                      && gchar_cursor() == NUL)
-               stuffReadbuff((char_u *)"dd");
+               stuffReadbuff((char_u *)"gJ");
            else
                stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
        }


Best,
Christian
-- 
Wußten Sie, daß Sie wenn Sie einen Polizisten tätlich angreifen bis
zu zwei Jahre Haft bekommen können?  Wenn Sie aber das Polizeiauto
beschädigen, gibt es bis zu fünf Jahren.
                -- Hagen Rether

-- 
-- 
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/20190918154221.GO30959%40256bit.org.

Raspunde prin e-mail lui