diff options
author | James McCoy <jamessan@jamessan.com> | 2016-12-01 13:32:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-01 13:32:12 -0500 |
commit | 77dceaaeb71a78f3db91bed4264e6b2f63cbfde2 (patch) | |
tree | 3c951aa27d7af0e5fc963322b3fa7ccd37a45b56 /src/nvim/message.c | |
parent | 6c1d81aef2acee88f61eef5303468063e2c51d9b (diff) | |
parent | 909b7d9dea6127632905da3758de3c93fa58896c (diff) | |
download | rneovim-77dceaaeb71a78f3db91bed4264e6b2f63cbfde2.tar.gz rneovim-77dceaaeb71a78f3db91bed4264e6b2f63cbfde2.tar.bz2 rneovim-77dceaaeb71a78f3db91bed4264e6b2f63cbfde2.zip |
Merge pull request #5675 from brcolow/vim-7.4.1738
vim-patch:7.4.17[35,38,39]
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index f9cfc49197..3163a797ed 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -720,14 +720,47 @@ int delete_first_msg(void) void ex_messages(exarg_T *eap) { struct msg_hist *p; + int c = 0; - msg_hist_off = TRUE; + if (STRCMP(eap->arg, "clear") == 0) { + int keep = eap->addr_count == 0 ? 0 : eap->line2; + + while (msg_hist_len > keep) { + (void)delete_first_msg(); + } + return; + } + + if (*eap->arg != NUL) { + EMSG(_(e_invarg)); + return; + } + + msg_hist_off = true; + + p = first_msg_hist; + + if (eap->addr_count != 0) { + // Count total messages + for (; p != NULL && !got_int; p = p->next) { + c++; + } + + c -= eap->line2; + + // Skip without number of messages specified + for (p = first_msg_hist; p != NULL && !got_int && c > 0; p = p->next, c--) { + } + } - for (p = first_msg_hist; p != NULL && !got_int; p = p->next) - if (p->msg != NULL) + // Display what was not skipped. + for (; p != NULL && !got_int; p = p->next) { + if (p->msg != NULL) { msg_attr(p->msg, p->attr); + } + } - msg_hist_off = FALSE; + msg_hist_off = false; } /* |