Mercurial > vim
comparison src/message.c @ 8897:a410390e340b v7.4.1735
commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 14 17:16:22 2016 +0200
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 14 Apr 2016 17:30:07 +0200 |
parents | 7c98c5d0298c |
children | b4dad96ade29 |
comparison
equal
deleted
inserted
replaced
8896:fc57c7ed0642 | 8897:a410390e340b |
---|---|
768 void | 768 void |
769 ex_messages(exarg_T *eap UNUSED) | 769 ex_messages(exarg_T *eap UNUSED) |
770 { | 770 { |
771 struct msg_hist *p; | 771 struct msg_hist *p; |
772 char_u *s; | 772 char_u *s; |
773 int c = 0; | |
774 | |
775 if (STRCMP(eap->arg, "clear") == 0) | |
776 { | |
777 int keep = eap->addr_count == 0 ? 0 : eap->line2; | |
778 | |
779 while (msg_hist_len > keep) | |
780 (void)delete_first_msg(); | |
781 return; | |
782 } | |
783 | |
784 if (*eap->arg != NUL) | |
785 { | |
786 EMSG(_(e_invarg)); | |
787 return; | |
788 } | |
773 | 789 |
774 msg_hist_off = TRUE; | 790 msg_hist_off = TRUE; |
775 | 791 |
776 s = mch_getenv((char_u *)"LANG"); | 792 s = mch_getenv((char_u *)"LANG"); |
777 if (s != NULL && *s != NUL) | 793 if (s != NULL && *s != NUL) |
778 msg_attr((char_u *) | 794 msg_attr((char_u *) |
779 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), | 795 _("Messages maintainer: Bram Moolenaar <Bram@vim.org>"), |
780 hl_attr(HLF_T)); | 796 hl_attr(HLF_T)); |
781 | 797 |
782 for (p = first_msg_hist; p != NULL && !got_int; p = p->next) | 798 p = first_msg_hist; |
799 | |
800 if (eap->addr_count != 0) | |
801 { | |
802 /* Count total messages */ | |
803 for (; p != NULL && !got_int; p = p->next) | |
804 c++; | |
805 | |
806 c -= eap->line2; | |
807 | |
808 /* Skip without number of messages specified */ | |
809 for (p = first_msg_hist; p != NULL && !got_int && c > 0; | |
810 p = p->next, c--); | |
811 } | |
812 | |
813 /* Display what was not skipped. */ | |
814 for (; p != NULL && !got_int; p = p->next) | |
783 if (p->msg != NULL) | 815 if (p->msg != NULL) |
784 msg_attr(p->msg, p->attr); | 816 msg_attr(p->msg, p->attr); |
785 | 817 |
786 msg_hist_off = FALSE; | 818 msg_hist_off = FALSE; |
787 } | 819 } |