summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-10-17 14:25:24 +0000
committerBram Moolenaar <Bram@vim.org>2006-10-17 14:25:24 +0000
commit1769d5a8c9209f77e4cff8e28a3883c0904d23fb (patch)
tree507b6713eac6d1c88d2b32d144f729b053293f2b /src/ops.c
parent8b402a0a8700593f05b34c8219bd2c1f6eabb466 (diff)
downloadvim-git-1769d5a8c9209f77e4cff8e28a3883c0904d23fb.tar.gz
updated for version 7.0-141v7.0.141
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ops.c b/src/ops.c
index be7091f48..4f45aea42 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1480,9 +1480,10 @@ get_spec_reg(regname, argp, allocated, errmsg)
* return FAIL for failure, OK otherwise
*/
int
-cmdline_paste_reg(regname, literally)
+cmdline_paste_reg(regname, literally, remcr)
int regname;
int literally; /* Insert text literally instead of "as typed" */
+ int remcr; /* don't add trailing CR */
{
long i;
@@ -1494,8 +1495,13 @@ cmdline_paste_reg(regname, literally)
{
cmdline_paste_str(y_current->y_array[i], literally);
- /* insert ^M between lines and after last line if type is MLINE */
- if (y_current->y_type == MLINE || i < y_current->y_size - 1)
+ /* Insert ^M between lines and after last line if type is MLINE.
+ * Don't do this when "remcr" is TRUE and the next line is empty. */
+ if (y_current->y_type == MLINE
+ || (i < y_current->y_size - 1
+ && !(remcr
+ && i == y_current->y_size - 2
+ && *y_current->y_array[i + 1] == NUL)))
cmdline_paste_str((char_u *)"\r", literally);
/* Check for CTRL-C, in case someone tries to paste a few thousand