diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-11-26 20:34:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-11-26 20:34:00 +0100 |
commit | fccbf068f8c85474db8d8dead1530321d1f3e5b8 (patch) | |
tree | 53f940fd2f9ce11dcf6fb2b688fd1eea604f3320 /src/clipboard.c | |
parent | ce7be3a0e6f19bc85990bb8fcfe5e208944777b4 (diff) |
patch 8.2.2057: getting the selection may trigger TextYankPost autocmdv8.2.2057
Problem: Getting the selection may trigger TextYankPost autocmd.
Solution: Only trigger the autocommand when yanking in Vim, not for getting
the selection. (closes #7367)
Diffstat (limited to 'src/clipboard.c')
-rw-r--r-- | src/clipboard.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/clipboard.c b/src/clipboard.c index 5db13a0d21..3084ce1871 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -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()) { |