patch 9.1.1322: small delete register cannot paste multi-line correctly
Commit:
https://github.com/vim/vim/commit/7e93d4c617784e03f539d139f3475bd72c04a6e5
Author: phanium <[email protected]>
Date: Fri Apr 18 18:32:52 2025 +0200
patch 9.1.1322: small delete register cannot paste multi-line correctly
Problem: small delete register cannot paste multi-line correctly
(after v8.2.2189)
Solution: caused by 032a2d050b82b146d70d6ff714838ee62c07d8ad, so make
this logic handle charwise only (phanium)
closes: #17151
Signed-off-by: phanium <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/register.c b/src/register.c
index 267e0fcc4..9d2770669 100644
--- a/src/register.c
+++ b/src/register.c
@@ -846,7 +846,7 @@ insert_reg(
{
for (i = 0; i < y_current->y_size; ++i)
{
- if (regname == '-')
+ if (regname == '-' && y_current->y_type == MCHAR)
{
int dir = BACKWARD;
if ((State & REPLACE_FLAG) != 0)
@@ -867,11 +867,13 @@ insert_reg(
do_put(regname, NULL, dir, 1L, PUT_CURSEND);
}
else
+ {
stuffescaped(y_current->y_array[i].string, literally);
- // Insert a newline between lines and after last line if
- // y_type is MLINE.
- if (y_current->y_type == MLINE || i < y_current->y_size - 1)
- stuffcharReadbuff('
');
+ // Insert a newline between lines and after last line if
+ // y_type is MLINE.
+ if (y_current->y_type == MLINE || i < y_current->y_size - 1)
+ stuffcharReadbuff('
');
+ }
}
}
}
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index 981f9d227..b597ab326 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -1204,4 +1204,13 @@ func Test_mark_from_yank()
bw!
endfunc
+func Test_insert_small_delete_linewise()
+ new
+ call setline(1, ['foo'])
+ call cursor(1, 1)
+ exe ":norm! \"-cc\<C-R>-"
+ call assert_equal(['foo', ''], getline(1, '$'))
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 4c9f4ce53..4990e4475 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1322,
/**/
1321,
/**/
--
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1u5opr-00AstR-6k%40256bit.org.