mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
clipboard: handle middle-click paste correctly.
Also handle clipboard errors more like vim: paste from unnamed register if clipboard provider fails.
This commit is contained in:
parent
0e39b2c936
commit
c30f2ac25d
@ -2016,6 +2016,9 @@ do_mouse (
|
||||
if (regname == '.')
|
||||
insert_reg(regname, true);
|
||||
else {
|
||||
if (regname == 0 && eval_has_provider("clipboard")) {
|
||||
regname = '*';
|
||||
}
|
||||
if ((State & REPLACE_FLAG) && !yank_register_mline(regname))
|
||||
insert_reg(regname, true);
|
||||
else {
|
||||
@ -2279,6 +2282,9 @@ do_mouse (
|
||||
* Middle mouse click: Put text before cursor.
|
||||
*/
|
||||
if (which_button == MOUSE_MIDDLE) {
|
||||
if (regname == 0 && eval_has_provider("clipboard")) {
|
||||
regname = '*';
|
||||
}
|
||||
if (yank_register_mline(regname)) {
|
||||
if (mouse_past_bottom)
|
||||
dir = FORWARD;
|
||||
|
@ -765,7 +765,10 @@ yankreg_T *get_yank_register(int regname, int mode)
|
||||
if (mode == YREG_PASTE && get_clipboard(regname, ®, false)) {
|
||||
// reg is set to clipboard contents.
|
||||
return reg;
|
||||
} else if (mode != YREG_YANK && (regname == 0 || regname == '"') && y_previous != NULL) {
|
||||
} else if (mode != YREG_YANK
|
||||
&& (regname == 0 || regname == '"' || regname == '*' || regname == '+')
|
||||
&& y_previous != NULL) {
|
||||
// in case clipboard not available, paste from previous used register
|
||||
return y_previous;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user