if (list == NULL)
return;
+ // Make sure regcontents will be up to date
+# ifdef FEAT_CLIPBOARD_PROVIDER
+ inc_clip_provider();
+ call_clip_provider_request(regname);
+# endif
+# ifdef FEAT_CLIPBOARD
+ if (clipmethod != CLIPMETHOD_PROVIDER)
+ regname = may_get_selection(regname);
+# endif
+
if (regname == '.')
{
if (last_insert_ga.ga_data != NULL)
(void)dict_add_string_len(v_event, "operator", buf, (int)buflen);
add_regtype_to_dict(regname, v_event, buf, sizeof(buf));
+# ifdef FEAT_CLIPBOARD_PROVIDER
+ dec_clip_provider();
+# endif
(void)dict_add_bool(v_event, "visual", VIsual_active);
adjust_clip_reg(®name);
#endif
#ifdef FEAT_CLIPBOARD_PROVIDER
+ inc_clip_provider();
call_clip_provider_request(regname);
#endif
#ifdef FEAT_CLIPBOARD
// TextPutPost after TextPutPre.
if (has_textputpre())
put_do_autocmd('.', NULL, NULL, false, dir);
+#endif
+#ifdef FEAT_CLIPBOARD_PROVIDER
+ dec_clip_provider();
+#endif
+#ifdef FEAT_EVAL
if (has_textputpost())
put_do_autocmd('.', NULL, NULL, true, dir);
insert_string.string = expr_result;
else if (get_spec_reg(regname, &insert_string.string, &allocated, TRUE)
&& insert_string.string == NULL)
+ {
+#ifdef FEAT_CLIPBOARD_PROVIDER
+ dec_clip_provider();
+#endif
return;
+ }
// Autocommands may be executed when saving lines for undo. This might
// make "y_array" invalid, so we start undo now to avoid that.
// move to start of next multi-byte character
curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
else
- if (c != TAB || cur_ve_flags != VE_ALL)
- ++curwin->w_cursor.col;
+ if (c != TAB || cur_ve_flags != VE_ALL)
+ ++curwin->w_cursor.col;
++col;
}
else
curbuf->b_op_end = orig_end;
}
+#ifdef FEAT_CLIPBOARD_PROVIDER
+ dec_clip_provider();
+#endif
+
#ifdef FEAT_EVAL
if (has_textputpost())
{
bw!
+ new
+ " Emitting TextPutPre/TextPutPost/TextYankPost may cause a clipboard access
+ "
+ " Note that TextPutPost will always cause a second clipboard access, since a
+ " TextPutPre may have changed the clipboard, meaning another "paste" call is
+ " needed to make sure everything is up to date.
+ augroup TextAutocmd
+ autocmd!
+ autocmd TextPutPost * let g:putpost = 1
+ autocmd TextPutPre * let g:putpre = 1
+ autocmd TextYankPost * let g:yankpost = 1
+ augroup END
+
+ let g:putpost = 0
+ let g:putpre = 0
+ let g:yankpost = 0
+
+ let g:vim_paste_count = {'*': 0, '+': 0}
+ let g:vim_copy_count = {'*': 0, '+': 0}
+
+ call setline(1, "hello world!")
+
+ yank +
+
+ yank *
+
+ put +
+
+ put *
+
+ call assert_equal(2, g:vim_paste_count['+'])
+ call assert_equal(1, g:vim_copy_count['+'])
+
+ call assert_equal(2, g:vim_paste_count['*'])
+ call assert_equal(1, g:vim_copy_count['*'])
+
+ call assert_equal(1, g:putpost)
+ call assert_equal(1, g:putpre)
+ call assert_equal(1, g:yankpost)
+
+ bw!
+ unlet g:putpost
+ unlet g:putpre
+ unlet g:yankpost
+ autocmd! TextAutocmd
+
set clipmethod&
set clipboard&
endfunc