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:
@@ -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())
|
||||
{
|
||||
|
Reference in New Issue
Block a user