patch 8.2.2914: cannot paste a block without adding padding
Problem: Cannot paste a block without adding padding.
Solution: Add "zp" and "zP" which paste without adding padding. (Christian
Brabandt, closes #8289)
diff --git a/src/register.c b/src/register.c
index 6ba4e89..f4d9343 100644
--- a/src/register.c
+++ b/src/register.c
@@ -1497,6 +1497,7 @@
* "flags": PUT_FIXINDENT make indent look nice
* PUT_CURSEND leave cursor after end of new text
* PUT_LINE force linewise put (":put")
+ * PUT_BLOCK_INNER in block mode, do not add trailing spaces
*/
void
do_put(
@@ -1794,7 +1795,7 @@
bd.textcol = 0;
for (i = 0; i < y_size; ++i)
{
- int spaces;
+ int spaces = 0;
char shortline;
bd.startspaces = 0;
@@ -1845,12 +1846,16 @@
yanklen = (int)STRLEN(y_array[i]);
- // calculate number of spaces required to fill right side of block
- spaces = y_width + 1;
- for (j = 0; j < yanklen; j++)
- spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0);
- if (spaces < 0)
- spaces = 0;
+ if ((flags & PUT_BLOCK_INNER) == 0)
+ {
+ // calculate number of spaces required to fill right side of
+ // block
+ spaces = y_width + 1;
+ for (j = 0; j < yanklen; j++)
+ spaces -= lbr_chartabsize(NULL, &y_array[i][j], 0);
+ if (spaces < 0)
+ spaces = 0;
+ }
// insert the new text
totlen = count * (yanklen + spaces) + bd.startspaces + bd.endspaces;