From 0c0ef489f95f16ce45f4a59c50f166d22f6d8ee4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 30 Aug 2025 01:39:43 -0400 Subject: [PATCH] vim-patch:8.1.1136: decoding of mouse click escape sequence is not tested (#35551) Problem: Decoding of mouse click escape sequence is not tested. Solution: Add a test for xterm and SGR using low-level input. Make low-level input execution with feedkeys() work. https://github.com/vim/vim/commit/905dd905debfde403b2a18178ccc1f8e118f4f2b Co-authored-by: Bram Moolenaar --- src/nvim/api/vim.c | 2 +- src/nvim/ex_docmd.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 7c346d46e5..83452e3bf1 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -332,7 +332,7 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_ks) if (!dangerous) { ex_normal_busy++; } - exec_normal(true); + exec_normal(true, lowlevel); if (!dangerous) { ex_normal_busy--; } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index e5612ad6be..e39f17618e 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7072,21 +7072,26 @@ void exec_normal_cmd(char *cmd, int remap, bool silent) { // Stuff the argument into the typeahead buffer. ins_typebuf(cmd, remap, 0, true, silent); - exec_normal(false); + exec_normal(false, false); } /// Execute normal_cmd() until there is no typeahead left. /// /// @param was_typed whether or not something was typed -void exec_normal(bool was_typed) +/// @param use_vpeekc true to use vpeekc() to check for available chars +void exec_normal(bool was_typed, bool use_vpeekc) { oparg_T oa; + int c; + // When calling vpeekc() from feedkeys() it will return Ctrl_C when there + // is nothing to get, so also check for Ctrl_C. clear_oparg(&oa); finish_op = false; while ((!stuff_empty() || ((was_typed || !typebuf_typed()) - && typebuf.tb_len > 0)) + && typebuf.tb_len > 0) + || (use_vpeekc && (c = vpeekc()) != NUL && c != Ctrl_C)) && !got_int) { update_topline_cursor(); normal_cmd(&oa, true); // execute a Normal mode cmd