aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 7b42467184..5b35af9209 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -61,8 +61,9 @@
#include "nvim/mouse.h"
#include "nvim/undo.h"
#include "nvim/window.h"
-#include "nvim/os/event.h"
+#include "nvim/event/loop.h"
#include "nvim/os/time.h"
+#include "nvim/os/input.h"
/*
* The Visual area is remembered for reselection.
@@ -487,12 +488,12 @@ normal_cmd (
/*
* Get the command character from the user.
*/
- event_enable_deferred();
+ input_enable_events();
c = safe_vgetc();
- event_disable_deferred();
+ input_disable_events();
if (c == K_EVENT) {
- event_process();
+ queue_process_events(loop.events);
return;
}
@@ -2016,6 +2017,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 {
@@ -2105,11 +2109,6 @@ do_mouse (
* NOTE: Ignore right button down and drag mouse events.
* Windows only shows the popup menu on the button up event.
*/
-#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
- || defined(FEAT_GUI_MAC)
- if (!is_click)
- return false;
-#endif
return false;
}
if (which_button == MOUSE_LEFT
@@ -2284,6 +2283,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;
@@ -5740,22 +5742,10 @@ static void nv_optrans(cmdarg_T *cap)
static char_u *str = (char_u *)"xXDCsSY&";
if (!checkclearopq(cap->oap)) {
- /* In Vi "2D" doesn't delete the next line. Can't translate it
- * either, because "2." should also not use the count. */
- if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL) {
- cap->oap->start = curwin->w_cursor;
- cap->oap->op_type = OP_DELETE;
- set_op_var(OP_DELETE);
- cap->count1 = 1;
- nv_dollar(cap);
- finish_op = true;
- ResetRedobuff();
- AppendCharToRedobuff('D');
- } else {
- if (cap->count0)
- stuffnumReadbuff(cap->count0);
- stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
+ if (cap->count0) {
+ stuffnumReadbuff(cap->count0);
}
+ stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
}
cap->opcount = 0;
}
@@ -6553,9 +6543,6 @@ static void n_opencmd(cmdarg_T *cap)
0, 0)) {
if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum)
update_single_line(curwin, oldline);
- /* When '#' is in 'cpoptions' ignore the count. */
- if (vim_strchr(p_cpo, CPO_HASH) != NULL)
- cap->count1 = 1;
invoke_edit(cap, false, cap->cmdchar, true);
}
}
@@ -7278,7 +7265,10 @@ static void nv_put(cmdarg_T *cap)
*/
was_visual = true;
regname = cap->oap->regname;
- if (regname == 0 || regname == '"'
+ // '+' and '*' could be the same selection
+ bool clipoverwrite = (regname == '+' || regname == '*')
+ && (cb_flags & CB_UNNAMEDMASK);
+ if (regname == 0 || regname == '"' || clipoverwrite
|| ascii_isdigit(regname) || regname == '-') {
// The delete might overwrite the register we want to put, save it first
savereg = copy_register(regname);