summaryrefslogtreecommitdiff
path: root/src/register.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/register.c')
-rw-r--r--src/register.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/register.c b/src/register.c
index 3fc8b6340..cd2e0e156 100644
--- a/src/register.c
+++ b/src/register.c
@@ -1550,6 +1550,7 @@ do_put(
long j;
struct block_def bd;
char_u **y_array = NULL;
+ yankreg_T *y_current_used = NULL;
long nr_lines = 0;
pos_T new_cursor;
int indent;
@@ -1660,6 +1661,7 @@ do_put(
y_width = y_current->y_width;
y_size = y_current->y_size;
y_array = y_current->y_array;
+ y_current_used = y_current;
}
if (y_type == MLINE)
@@ -2208,6 +2210,14 @@ error:
else
changed_lines(curbuf->b_op_start.lnum, 0,
curbuf->b_op_start.lnum, nr_lines);
+ if (y_current_used != NULL && (y_current_used != y_current
+ || y_current->y_array != y_array))
+ {
+ // Something invoked through changed_lines() has changed the
+ // yank buffer, e.g. a GUI clipboard callback.
+ emsg(_(e_yank_register_changed_while_using_it));
+ goto end;
+ }
// Put the '] mark on the first byte of the last inserted character.
// Correct the length for change in indent.