diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-09-04 15:31:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-04 15:31:56 +0200 |
commit | e7e2c8d7ffbfdb372eb974d8c14c49d9ce83ed77 (patch) | |
tree | dd078cb281b2617636cccfd52c6ecd6d0b699be1 | |
parent | 38806f23edfcba8cb7f7b80039d268ae3ffb0557 (diff) | |
parent | ac6fd11fa128b2a28611f54c478e84f43f728aea (diff) | |
download | rneovim-e7e2c8d7ffbfdb372eb974d8c14c49d9ce83ed77.tar.gz rneovim-e7e2c8d7ffbfdb372eb974d8c14c49d9ce83ed77.tar.bz2 rneovim-e7e2c8d7ffbfdb372eb974d8c14c49d9ce83ed77.zip |
Merge pull request #10926 from blueyed/fix-echon-q
Check got_int in msg_multiline_attr with ex_echo
-rw-r--r-- | src/nvim/eval.c | 2 | ||||
-rw-r--r-- | src/nvim/message.c | 6 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 34 |
3 files changed, 38 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a50474a55a..fa9777b651 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -20894,7 +20894,7 @@ void ex_echo(exarg_T *eap) char *tofree = encode_tv2echo(&rettv, NULL); if (*tofree != NUL) { msg_ext_set_kind("echo"); - msg_multiline_attr(tofree, echo_attr); + msg_multiline_attr(tofree, echo_attr, true); } xfree(tofree); } diff --git a/src/nvim/message.c b/src/nvim/message.c index ac731210d7..b5a5f656a0 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -222,12 +222,12 @@ int msg_attr(const char *s, const int attr) } /// similar to msg_outtrans_attr, but support newlines and tabs. -void msg_multiline_attr(const char *s, int attr) +void msg_multiline_attr(const char *s, int attr, bool check_int) FUNC_ATTR_NONNULL_ALL { const char *next_spec = s; - while (next_spec != NULL) { + while (next_spec != NULL && (!check_int || !got_int)) { next_spec = strpbrk(s, "\t\n\r"); if (next_spec != NULL) { @@ -306,7 +306,7 @@ bool msg_attr_keep(char_u *s, int attr, bool keep, bool multiline) s = buf; if (multiline) { - msg_multiline_attr((char *)s, attr); + msg_multiline_attr((char *)s, attr, false); } else { msg_outtrans_attr(s, attr); } diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index ed65c4526f..a6b9ef9387 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -1052,3 +1052,37 @@ describe('ui/msg_puts_printf', function() os.execute('cmake -E remove_directory '..test_build_dir..'/share') end) end) + +describe('pager', function() + local screen + + before_each(function() + clear() + screen = Screen.new(25, 5) + screen:attach() + screen:set_default_attr_ids({ + [1] = {bold = true, foreground = Screen.colors.Blue1}, + [4] = {bold = true, foreground = Screen.colors.SeaGreen4}, + }) + end) + + it('can be quit', function() + command("set more") + feed(':echon join(map(range(0, &lines*2), "v:val"), "\\n")<cr>') + screen:expect{grid=[[ + 0 | + 1 | + 2 | + 3 | + {4:-- More --}^ | + ]]} + feed('q') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + end) +end) |