1
0
forked from aniani/vim

patch 8.2.2057: getting the selection may trigger TextYankPost autocmd

Problem:    Getting the selection may trigger TextYankPost autocmd.
Solution:   Only trigger the autocommand when yanking in Vim, not for getting
            the selection. (closes #7367)
This commit is contained in:
Bram Moolenaar
2020-11-26 20:34:00 +01:00
parent ce7be3a0e6
commit fccbf068f8
5 changed files with 62 additions and 2 deletions

View File

@@ -2025,6 +2025,9 @@ clip_get_selection(Clipboard_T *cbd)
&& get_y_register(STAR_REGISTER)->y_array != NULL))
return;
// Avoid triggering autocmds such as TextYankPost.
block_autocmds();
// Get the text between clip_star.start & clip_star.end
old_y_previous = get_y_previous();
old_y_current = get_y_current();
@@ -2054,6 +2057,8 @@ clip_get_selection(Clipboard_T *cbd)
curbuf->b_op_end = old_op_end;
VIsual = old_visual;
VIsual_mode = old_visual_mode;
unblock_autocmds();
}
else if (!is_clipboard_needs_update())
{