diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_docmd.c | 5 | ||||
-rw-r--r-- | src/nvim/terminal.c | 1 | ||||
-rw-r--r-- | src/nvim/tui/input.c | 15 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 7c857cde82..8aa670fc74 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -603,6 +603,11 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, cmd_getline, cmd_cookie); recursive--; + // Ignore trailing '|'-separated commands in preview-mode ('inccommand'). + if (State & CMDPREVIEW) { + next_cmdline = NULL; + } + if (cmd_cookie == (void *)&cmd_loop_cookie) /* Use "current_line" from "cmd_loop_cookie", it may have been * incremented when defining a function. */ diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 5a05847197..d006477c80 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1106,6 +1106,7 @@ static void refresh_timer_cb(TimeWatcher *watcher, void *data) { refresh_pending = false; if (exiting // Cannot redraw (requires event loop) during teardown/exit. + || (State & CMDPREVIEW) // WM_LIST (^D) is not redrawn, unlike the normal wildmenu. So we must // skip redraws to keep it visible. || wild_menu_showing == WM_LIST) { diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c index b04a6ce4f9..0362820687 100644 --- a/src/nvim/tui/input.c +++ b/src/nvim/tui/input.c @@ -170,11 +170,21 @@ static void forward_mouse_event(TermInput *input, TermKeyKey *key) char buf[64]; size_t len = 0; int button, row, col; + static int last_pressed_button = 0; TermKeyMouseEvent ev; termkey_interpret_mouse(input->tk, key, &ev, &button, &row, &col); - if (ev != TERMKEY_MOUSE_PRESS && ev != TERMKEY_MOUSE_DRAG - && ev != TERMKEY_MOUSE_RELEASE) { + if ((ev == TERMKEY_MOUSE_RELEASE || ev == TERMKEY_MOUSE_DRAG) + && button == 0) { + // Some terminals (like urxvt) don't report which button was released. + // libtermkey reports button 0 in this case. + // For drag and release, we can reasonably infer the button to be the last + // pressed one. + button = last_pressed_button; + } + + if (button == 0 || (ev != TERMKEY_MOUSE_PRESS && ev != TERMKEY_MOUSE_DRAG + && ev != TERMKEY_MOUSE_RELEASE)) { return; } @@ -210,6 +220,7 @@ static void forward_mouse_event(TermInput *input, TermKeyKey *key) "ScrollWheelDown"); } else { len += (size_t)snprintf(buf + len, sizeof(buf) - len, "Mouse"); + last_pressed_button = button; } break; case TERMKEY_MOUSE_DRAG: |