comparison src/clipboard.c @ 23021:d10a37eb91ee v8.2.2057

patch 8.2.2057: getting the selection may trigger TextYankPost autocmd Commit: https://github.com/vim/vim/commit/fccbf068f8c85474db8d8dead1530321d1f3e5b8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 26 20:34:00 2020 +0100 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)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 Nov 2020 20:45:03 +0100
parents ec89debe5037
children 826a6406ea7b
comparison
equal deleted inserted replaced
23020:61decb85346b 23021:d10a37eb91ee
2023 && get_y_register(PLUS_REGISTER)->y_array != NULL) 2023 && get_y_register(PLUS_REGISTER)->y_array != NULL)
2024 || (cbd == &clip_star 2024 || (cbd == &clip_star
2025 && get_y_register(STAR_REGISTER)->y_array != NULL)) 2025 && get_y_register(STAR_REGISTER)->y_array != NULL))
2026 return; 2026 return;
2027 2027
2028 // Avoid triggering autocmds such as TextYankPost.
2029 block_autocmds();
2030
2028 // Get the text between clip_star.start & clip_star.end 2031 // Get the text between clip_star.start & clip_star.end
2029 old_y_previous = get_y_previous(); 2032 old_y_previous = get_y_previous();
2030 old_y_current = get_y_current(); 2033 old_y_current = get_y_current();
2031 old_cursor = curwin->w_cursor; 2034 old_cursor = curwin->w_cursor;
2032 old_curswant = curwin->w_curswant; 2035 old_curswant = curwin->w_curswant;
2052 curwin->w_set_curswant = old_set_curswant; 2055 curwin->w_set_curswant = old_set_curswant;
2053 curbuf->b_op_start = old_op_start; 2056 curbuf->b_op_start = old_op_start;
2054 curbuf->b_op_end = old_op_end; 2057 curbuf->b_op_end = old_op_end;
2055 VIsual = old_visual; 2058 VIsual = old_visual;
2056 VIsual_mode = old_visual_mode; 2059 VIsual_mode = old_visual_mode;
2060
2061 unblock_autocmds();
2057 } 2062 }
2058 else if (!is_clipboard_needs_update()) 2063 else if (!is_clipboard_needs_update())
2059 { 2064 {
2060 clip_free_selection(cbd); 2065 clip_free_selection(cbd);
2061 2066