mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*message.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
*message.txt* For Vim version 7.4. Last change: 2016 Apr 14
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -19,6 +19,15 @@ The ":messages" command can be used to view previously given messages. This
|
|||||||
is especially useful when messages have been overwritten or truncated. This
|
is especially useful when messages have been overwritten or truncated. This
|
||||||
depends on the 'shortmess' option.
|
depends on the 'shortmess' option.
|
||||||
|
|
||||||
|
:messages Show all messages.
|
||||||
|
|
||||||
|
:{count}messages Show the {count} most recent messages.
|
||||||
|
|
||||||
|
:messages clear Clear all messages.
|
||||||
|
|
||||||
|
:{count}messages clear Clear messages, keeping only the {count} most
|
||||||
|
recent ones.
|
||||||
|
|
||||||
The number of remembered messages is fixed at 20 for the tiny version and 200
|
The number of remembered messages is fixed at 20 for the tiny version and 200
|
||||||
for other versions.
|
for other versions.
|
||||||
|
|
||||||
@@ -58,8 +67,9 @@ If you are lazy, it also works without the shift key: >
|
|||||||
When an error message is displayed, but it is removed before you could read
|
When an error message is displayed, but it is removed before you could read
|
||||||
it, you can see it again with: >
|
it, you can see it again with: >
|
||||||
:echo errmsg
|
:echo errmsg
|
||||||
or view a list of recent messages with: >
|
Or view a list of recent messages with: >
|
||||||
:messages
|
:messages
|
||||||
|
See `:messages` above.
|
||||||
|
|
||||||
|
|
||||||
LIST OF MESSAGES
|
LIST OF MESSAGES
|
||||||
|
@@ -886,7 +886,7 @@ EX(CMD_menutranslate, "menutranslate", ex_menutranslate,
|
|||||||
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
|
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_messages, "messages", ex_messages,
|
EX(CMD_messages, "messages", ex_messages,
|
||||||
TRLBAR|CMDWIN,
|
EXTRA|TRLBAR|RANGE|CMDWIN,
|
||||||
ADDR_LINES),
|
ADDR_LINES),
|
||||||
EX(CMD_mkexrc, "mkexrc", ex_mkrc,
|
EX(CMD_mkexrc, "mkexrc", ex_mkrc,
|
||||||
BANG|FILE1|TRLBAR|CMDWIN,
|
BANG|FILE1|TRLBAR|CMDWIN,
|
||||||
|
@@ -770,6 +770,22 @@ ex_messages(exarg_T *eap UNUSED)
|
|||||||
{
|
{
|
||||||
struct msg_hist *p;
|
struct msg_hist *p;
|
||||||
char_u *s;
|
char_u *s;
|
||||||
|
int c = 0;
|
||||||
|
|
||||||
|
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;
|
msg_hist_off = TRUE;
|
||||||
|
|
||||||
@@ -779,7 +795,23 @@ ex_messages(exarg_T *eap UNUSED)
|
|||||||
_("Messages maintainer: Bram Moolenaar <Bram@vim.org>"),
|
_("Messages maintainer: Bram Moolenaar <Bram@vim.org>"),
|
||||||
hl_attr(HLF_T));
|
hl_attr(HLF_T));
|
||||||
|
|
||||||
for (p = first_msg_hist; p != NULL && !got_int; p = p->next)
|
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)
|
if (p->msg != NULL)
|
||||||
msg_attr(p->msg, p->attr);
|
msg_attr(p->msg, p->attr);
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@ source test_join.vim
|
|||||||
source test_lispwords.vim
|
source test_lispwords.vim
|
||||||
source test_matchstrpos.vim
|
source test_matchstrpos.vim
|
||||||
source test_menu.vim
|
source test_menu.vim
|
||||||
|
source test_messages.vim
|
||||||
source test_partial.vim
|
source test_partial.vim
|
||||||
source test_reltime.vim
|
source test_reltime.vim
|
||||||
source test_searchpos.vim
|
source test_searchpos.vim
|
||||||
|
42
src/testdir/test_messages.vim
Normal file
42
src/testdir/test_messages.vim
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
" Tests for :messages
|
||||||
|
|
||||||
|
function Test_messages()
|
||||||
|
let oldmore = &more
|
||||||
|
try
|
||||||
|
set nomore
|
||||||
|
|
||||||
|
let arr = map(range(10), '"hello" . v:val')
|
||||||
|
for s in arr
|
||||||
|
echomsg s | redraw
|
||||||
|
endfor
|
||||||
|
let result = ''
|
||||||
|
|
||||||
|
redir => result
|
||||||
|
2messages | redraw
|
||||||
|
redir END
|
||||||
|
|
||||||
|
" get last two messages
|
||||||
|
let msg = split(result, "\n")[1:][-2:]
|
||||||
|
call assert_equal(["hello8", "hello9"], msg)
|
||||||
|
|
||||||
|
" clear messages without last one
|
||||||
|
1messages clear
|
||||||
|
redir => result
|
||||||
|
redraw | 1messages
|
||||||
|
redir END
|
||||||
|
" get last last message
|
||||||
|
let msg = split(result, "\n")[1:][-1:]
|
||||||
|
call assert_equal(['hello9'], msg)
|
||||||
|
|
||||||
|
" clear all messages
|
||||||
|
messages clear
|
||||||
|
redir => result
|
||||||
|
redraw | 1messages
|
||||||
|
redir END
|
||||||
|
" get last last message
|
||||||
|
let msg = split(result, "\n")[1:][-1:]
|
||||||
|
call assert_equal([], msg)
|
||||||
|
finally
|
||||||
|
let &more = oldmore
|
||||||
|
endtry
|
||||||
|
endfunction
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1735,
|
||||||
/**/
|
/**/
|
||||||
1734,
|
1734,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user