mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
messages: support shortmess-=S in ext_messages
This commit is contained in:
parent
5a96161e86
commit
41f31ca90d
@ -706,6 +706,7 @@ events, which the UI must handle.
|
|||||||
"rpc_error" Error response from |rpcrequest()|
|
"rpc_error" Error response from |rpcrequest()|
|
||||||
"return_prompt" |press-enter| prompt after a multiple messages
|
"return_prompt" |press-enter| prompt after a multiple messages
|
||||||
"quickfix" Quickfix navigation message
|
"quickfix" Quickfix navigation message
|
||||||
|
"search_count" Search count message ("S" flag of 'shortmess')
|
||||||
"wmsg" Warning ("search hit BOTTOM", |W10|, …)
|
"wmsg" Warning ("search hit BOTTOM", |W10|, …)
|
||||||
New kinds may be added in the future; clients should treat unknown
|
New kinds may be added in the future; clients should treat unknown
|
||||||
kinds as the empty kind.
|
kinds as the empty kind.
|
||||||
|
@ -3018,7 +3018,10 @@ void give_warning(char_u *message, bool hl) FUNC_ATTR_NONNULL_ARG(1)
|
|||||||
} else {
|
} else {
|
||||||
keep_msg_attr = 0;
|
keep_msg_attr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg_ext_kind == NULL) {
|
||||||
msg_ext_set_kind("wmsg");
|
msg_ext_set_kind("wmsg");
|
||||||
|
}
|
||||||
|
|
||||||
if (msg_attr((const char *)message, keep_msg_attr) && msg_scrolled == 0) {
|
if (msg_attr((const char *)message, keep_msg_attr) && msg_scrolled == 0) {
|
||||||
set_keep_msg(message, keep_msg_attr);
|
set_keep_msg(message, keep_msg_attr);
|
||||||
|
@ -1168,7 +1168,9 @@ int do_search(
|
|||||||
// search stat. Use all the space available, so that the
|
// search stat. Use all the space available, so that the
|
||||||
// search state is right aligned. If there is not enough space
|
// search state is right aligned. If there is not enough space
|
||||||
// msg_strtrunc() will shorten in the middle.
|
// msg_strtrunc() will shorten in the middle.
|
||||||
if (msg_scrolled != 0) {
|
if (ui_has(kUIMessages)) {
|
||||||
|
len = 0; // adjusted below
|
||||||
|
} else if (msg_scrolled != 0) {
|
||||||
// Use all the columns.
|
// Use all the columns.
|
||||||
len = (int)(Rows - msg_row) * Columns - 1;
|
len = (int)(Rows - msg_row) * Columns - 1;
|
||||||
} else {
|
} else {
|
||||||
@ -4328,6 +4330,7 @@ static void search_stat(int dirc, pos_T *pos,
|
|||||||
|
|
||||||
// keep the message even after redraw, but don't put in history
|
// keep the message even after redraw, but don't put in history
|
||||||
msg_hist_off = true;
|
msg_hist_off = true;
|
||||||
|
msg_ext_set_kind("search_count");
|
||||||
give_warning(msgbuf, false);
|
give_warning(msgbuf, false);
|
||||||
msg_hist_off = false;
|
msg_hist_off = false;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ describe('ui/ext_messages', function()
|
|||||||
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
[4] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
[5] = {foreground = Screen.colors.Blue1},
|
[5] = {foreground = Screen.colors.Blue1},
|
||||||
[6] = {bold = true, reverse = true},
|
[6] = {bold = true, reverse = true},
|
||||||
|
[7] = {background = Screen.colors.Yellow},
|
||||||
|
[8] = {foreground = Screen.colors.Red},
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
after_each(function()
|
after_each(function()
|
||||||
@ -303,6 +305,33 @@ describe('ui/ext_messages', function()
|
|||||||
}}
|
}}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('shortmess-=S', function()
|
||||||
|
command('set shortmess-=S')
|
||||||
|
feed('iline 1\nline 2<esc>')
|
||||||
|
|
||||||
|
feed('/line<cr>')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
{7:^line} 1 |
|
||||||
|
{7:line} 2 |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
]], messages={
|
||||||
|
{content = {{"/line [1/2] W"}}, kind = "search_count"}
|
||||||
|
}}
|
||||||
|
|
||||||
|
feed('n')
|
||||||
|
screen:expect{grid=[[
|
||||||
|
{7:line} 1 |
|
||||||
|
{7:^line} 2 |
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
{1:~ }|
|
||||||
|
]], messages={
|
||||||
|
{content = {{"/line [2/2]"}}, kind = "search_count"}
|
||||||
|
}}
|
||||||
|
end)
|
||||||
|
|
||||||
it('&showmode', function()
|
it('&showmode', function()
|
||||||
command('imap <f2> <cmd>echomsg "stuff"<cr>')
|
command('imap <f2> <cmd>echomsg "stuff"<cr>')
|
||||||
feed('i')
|
feed('i')
|
||||||
|
Loading…
Reference in New Issue
Block a user