mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #5675 from brcolow/vim-7.4.1738
vim-patch:7.4.17[35,38,39]
This commit is contained in:
commit
77dceaaeb7
@ -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,9 +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
|
||||||
*E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317*
|
*E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317*
|
||||||
|
@ -35,6 +35,7 @@ local ADDR_LOADED_BUFFERS = 3
|
|||||||
local ADDR_BUFFERS = 4
|
local ADDR_BUFFERS = 4
|
||||||
local ADDR_TABS = 5
|
local ADDR_TABS = 5
|
||||||
local ADDR_QUICKFIX = 6
|
local ADDR_QUICKFIX = 6
|
||||||
|
local ADDR_OTHER = 99
|
||||||
|
|
||||||
-- The following table is described in ex_cmds_defs.h file.
|
-- The following table is described in ex_cmds_defs.h file.
|
||||||
return {
|
return {
|
||||||
@ -1604,8 +1605,8 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command='messages',
|
command='messages',
|
||||||
flags=bit.bor(TRLBAR, CMDWIN),
|
flags=bit.bor(EXTRA, TRLBAR, RANGE, CMDWIN),
|
||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_OTHER,
|
||||||
func='ex_messages',
|
func='ex_messages',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -73,6 +73,7 @@
|
|||||||
#define ADDR_BUFFERS 4
|
#define ADDR_BUFFERS 4
|
||||||
#define ADDR_TABS 5
|
#define ADDR_TABS 5
|
||||||
#define ADDR_QUICKFIX 6
|
#define ADDR_QUICKFIX 6
|
||||||
|
#define ADDR_OTHER 99
|
||||||
|
|
||||||
typedef struct exarg exarg_T;
|
typedef struct exarg exarg_T;
|
||||||
|
|
||||||
|
@ -720,14 +720,47 @@ int delete_first_msg(void)
|
|||||||
void ex_messages(exarg_T *eap)
|
void ex_messages(exarg_T *eap)
|
||||||
{
|
{
|
||||||
struct msg_hist *p;
|
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)
|
while (msg_hist_len > keep) {
|
||||||
if (p->msg != NULL)
|
(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_attr(p->msg, p->attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
msg_hist_off = FALSE;
|
msg_hist_off = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,6 +9,7 @@ source test_expr.vim
|
|||||||
source test_expr_utf8.vim
|
source test_expr_utf8.vim
|
||||||
source test_feedkeys.vim
|
source test_feedkeys.vim
|
||||||
source test_menu.vim
|
source test_menu.vim
|
||||||
|
source test_messages.vim
|
||||||
source test_options.vim
|
source test_options.vim
|
||||||
source test_popup.vim
|
source test_popup.vim
|
||||||
source test_regexp_utf8.vim
|
source test_regexp_utf8.vim
|
||||||
|
40
src/nvim/testdir/test_messages.vim
Normal file
40
src/nvim/testdir/test_messages.vim
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
" Tests for :messages
|
||||||
|
|
||||||
|
function Test_messages()
|
||||||
|
let oldmore = &more
|
||||||
|
try
|
||||||
|
set nomore
|
||||||
|
" Avoid the "message maintainer" line.
|
||||||
|
let $LANG = ''
|
||||||
|
|
||||||
|
let arr = map(range(10), '"hello" . v:val')
|
||||||
|
for s in arr
|
||||||
|
echomsg s | redraw
|
||||||
|
endfor
|
||||||
|
let result = ''
|
||||||
|
|
||||||
|
" get last two messages
|
||||||
|
redir => result
|
||||||
|
2messages | redraw
|
||||||
|
redir END
|
||||||
|
let msg_list = split(result, "\n")
|
||||||
|
call assert_equal(["hello8", "hello9"], msg_list)
|
||||||
|
|
||||||
|
" clear messages without last one
|
||||||
|
1messages clear
|
||||||
|
redir => result
|
||||||
|
redraw | messages
|
||||||
|
redir END
|
||||||
|
let msg_list = split(result, "\n")
|
||||||
|
call assert_equal(['hello9'], msg_list)
|
||||||
|
|
||||||
|
" clear all messages
|
||||||
|
messages clear
|
||||||
|
redir => result
|
||||||
|
redraw | messages
|
||||||
|
redir END
|
||||||
|
call assert_equal('', result)
|
||||||
|
finally
|
||||||
|
let &more = oldmore
|
||||||
|
endtry
|
||||||
|
endfunction
|
@ -705,11 +705,11 @@ static int included_patches[] = {
|
|||||||
1742,
|
1742,
|
||||||
1741,
|
1741,
|
||||||
1740,
|
1740,
|
||||||
// 1739,
|
1739,
|
||||||
// 1738,
|
1738,
|
||||||
// 1737 NA
|
// 1737 NA
|
||||||
// 1736 NA
|
// 1736 NA
|
||||||
// 1735,
|
1735,
|
||||||
1734,
|
1734,
|
||||||
// 1733 NA
|
// 1733 NA
|
||||||
1732,
|
1732,
|
||||||
|
Loading…
Reference in New Issue
Block a user