mirror of
https://github.com/neovim/neovim.git
synced 2025-10-02 07:58:35 +00:00
fix(mouse): do not fetch clipboard twice when pasting with middle button #33494
Problem: When doing paste operation mouse code tries to figure out it it is dealing with a multi-line register by calling yank_register_mline(), which fetches register data and checks its type. Later the code calls either do_put() or insert_reg() which fetch register data again. This is unnoticeable when working with internal neovim registers, but starts hurting when dealing with clipboards, especially remote one (forwarded X or socket tunnel or similar). Solution: Change yank_register_mline() to also return pointer to the register structure prepared for pasting, and insert_reg() to accept such register pointer and use it if it is supplied. do_put() already has support for accepting a register structure to be used for pasting. Fixes #33493
This commit is contained in:
@@ -3250,7 +3250,7 @@ static void ins_reg(void)
|
||||
|
||||
do_put(regname, NULL, BACKWARD, 1,
|
||||
(literally == Ctrl_P ? PUT_FIXINDENT : 0) | PUT_CURSEND);
|
||||
} else if (insert_reg(regname, literally) == FAIL) {
|
||||
} else if (insert_reg(regname, NULL, literally) == FAIL) {
|
||||
vim_beep(kOptBoFlagRegister);
|
||||
need_redraw = true; // remove the '"'
|
||||
} else if (stop_insert_mode) {
|
||||
|
Reference in New Issue
Block a user