Mercurial > vim
comparison src/message.c @ 355:644578c9e219
updated for version 7.0092
author | vimboss |
---|---|
date | Fri, 24 Jun 2005 23:01:23 +0000 |
parents | 64221fecdfa1 |
children | 22c8aff09ad3 |
comparison
equal
deleted
inserted
replaced
354:be0f21f63d2c | 355:644578c9e219 |
---|---|
741 if (msg_hist_off || msg_silent != 0) | 741 if (msg_hist_off || msg_silent != 0) |
742 return; | 742 return; |
743 | 743 |
744 /* Don't let the message history get too big */ | 744 /* Don't let the message history get too big */ |
745 while (msg_hist_len > 20) | 745 while (msg_hist_len > 20) |
746 { | 746 (void)delete_first_msg(); |
747 p = first_msg_hist; | 747 |
748 first_msg_hist = p->next; | |
749 vim_free(p->msg); | |
750 vim_free(p); | |
751 --msg_hist_len; | |
752 } | |
753 /* allocate an entry and add the message at the end of the history */ | 748 /* allocate an entry and add the message at the end of the history */ |
754 p = (struct msg_hist *)alloc((int)sizeof(struct msg_hist)); | 749 p = (struct msg_hist *)alloc((int)sizeof(struct msg_hist)); |
755 if (p != NULL) | 750 if (p != NULL) |
756 { | 751 { |
757 if (len < 0) | 752 if (len < 0) |
772 last_msg_hist = p; | 767 last_msg_hist = p; |
773 if (first_msg_hist == NULL) | 768 if (first_msg_hist == NULL) |
774 first_msg_hist = last_msg_hist; | 769 first_msg_hist = last_msg_hist; |
775 ++msg_hist_len; | 770 ++msg_hist_len; |
776 } | 771 } |
772 } | |
773 | |
774 /* | |
775 * Delete the first (oldest) message from the history. | |
776 * Returns FAIL if there are no messages. | |
777 */ | |
778 int | |
779 delete_first_msg() | |
780 { | |
781 struct msg_hist *p; | |
782 | |
783 if (msg_hist_len <= 0) | |
784 return FAIL; | |
785 p = first_msg_hist; | |
786 first_msg_hist = p->next; | |
787 vim_free(p->msg); | |
788 vim_free(p); | |
789 --msg_hist_len; | |
790 return OK; | |
777 } | 791 } |
778 | 792 |
779 /* | 793 /* |
780 * ":messages" command. | 794 * ":messages" command. |
781 */ | 795 */ |