diff options
author | ii14 <59243201+ii14@users.noreply.github.com> | 2021-12-08 17:43:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 09:43:58 -0700 |
commit | db4bc32c4aa00f17dee15e7e7593f9ec90b18242 (patch) | |
tree | 3ad0fdc2e4d7dcaeddf85cf9bea068fdda75e94c | |
parent | 5b117bbc75e7906b9400d1e04513b0626c9f8b74 (diff) | |
download | rneovim-db4bc32c4aa00f17dee15e7e7593f9ec90b18242.tar.gz rneovim-db4bc32c4aa00f17dee15e7e7593f9ec90b18242.tar.bz2 rneovim-db4bc32c4aa00f17dee15e7e7593f9ec90b18242.zip |
fix: check for interrupt in nvim_echo, write_msg and nlua_print (#16537)
Fixes `q` in more pager, where `:highlight` can be quit out of with a
single `q` keystroke, while in `:lua print(vim.inspect(vim))` it just
scrolls down a page.
-rw-r--r-- | src/nvim/api/vim.c | 5 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 36179b1fab..4f7c320129 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -842,7 +842,7 @@ void nvim_echo(Array chunks, Boolean history, Dictionary opts, Error *err) for (uint32_t i = 0; i < kv_size(hl_msg); i++) { HlMessageChunk chunk = kv_A(hl_msg, i); msg_multiline_attr((const char *)chunk.text.data, chunk.attr, - false, &need_clear); + true, &need_clear); } if (history) { msg_ext_set_kind("echomsg"); @@ -1842,6 +1842,9 @@ static void write_msg(String message, bool to_err) ++no_wait_return; for (uint32_t i = 0; i < message.size; i++) { + if (got_int) { + break; + } if (to_err) { PUSH_CHAR(i, err_pos, err_line_buf, emsg); } else { diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 6a8b70a158..a899ca63ac 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -521,6 +521,9 @@ static void nlua_print_event(void **argv) const size_t len = (size_t)(intptr_t)argv[1]-1; // exclude final NUL for (size_t i = 0; i < len;) { + if (got_int) { + break; + } const size_t start = i; while (i < len) { switch (str[i]) { |