summaryrefslogtreecommitdiff
path: root/src/ops.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-06-19 01:14:29 +0200
committerBram Moolenaar <Bram@vim.org>2011-06-19 01:14:29 +0200
commitd44347f1e7791ead2d90b1fda06d9f4e325d912e (patch)
treed00df322e29d233a3845b5c12c3973375dc4a073 /src/ops.c
parent19e609437873594b8b08aaceafbe81ef235044bf (diff)
downloadvim-git-d44347f1e7791ead2d90b1fda06d9f4e325d912e.tar.gz
updated for version 7.3.221v7.3.221
Problem: Text from the clipboard is sometimes handled as linewise, but not consistently. Solution: Assume the text is linewise when it ends in a CR or NL.
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/ops.c b/src/ops.c
index c41f84456..8c235220e 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -5733,7 +5733,9 @@ clip_get_selection(cbd)
}
}
-/* Convert from the GUI selection string into the '*'/'+' register */
+/*
+ * Convert from the GUI selection string into the '*'/'+' register.
+ */
void
clip_yank_selection(type, str, len, cbd)
int type;
@@ -6090,9 +6092,6 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
if (yank_type == MBLOCK)
yank_type = MAUTO;
#endif
- if (yank_type == MAUTO)
- yank_type = ((len > 0 && (str[len - 1] == '\n' || str[len - 1] == '\r'))
- ? MLINE : MCHAR);
str_to_reg(y_current, yank_type, str, len, block_len);
# ifdef FEAT_CLIPBOARD
@@ -6113,13 +6112,14 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
* is appended.
*/
static void
-str_to_reg(y_ptr, type, str, len, blocklen)
+str_to_reg(y_ptr, yank_type, str, len, blocklen)
struct yankreg *y_ptr; /* pointer to yank register */
- int type; /* MCHAR, MLINE or MBLOCK */
+ int yank_type; /* MCHAR, MLINE, MBLOCK, MAUTO */
char_u *str; /* string to put in register */
long len; /* length of string */
long blocklen; /* width of Visual block */
{
+ int type; /* MCHAR, MLINE or MBLOCK */
int lnum;
long start;
long i;
@@ -6136,6 +6136,12 @@ str_to_reg(y_ptr, type, str, len, blocklen)
if (y_ptr->y_array == NULL) /* NULL means empty register */
y_ptr->y_size = 0;
+ if (yank_type == MAUTO)
+ type = ((len > 0 && (str[len - 1] == NL || str[len - 1] == CAR))
+ ? MLINE : MCHAR);
+ else
+ type = yank_type;
+
/*
* Count the number of lines within the string
*/