mirror of
https://github.com/neovim/neovim.git
synced 2025-09-16 16:28:17 +00:00
vim-patch:7.4.1735
Problem: It is not possible to only see part of the message history. It is
not possible to clear messages.
Solution: Add a count to ":messages" and a clear argument. (Yasuhiro
Matsumoto)
451f849fd6
This commit is contained in:
@@ -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;
|
||||
|
||||
for (p = first_msg_hist; p != NULL && !got_int; p = p->next)
|
||||
if (p->msg != NULL)
|
||||
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--) {
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user