mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
feat(ui): specify whether msg_show event is added to history
Pass along whether message in msg_show event is added to the internal :messages history.
This commit is contained in:
@ -86,11 +86,13 @@ EVENTS
|
||||
|
||||
• |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in
|
||||
|api-fast| context.
|
||||
• Various additions for the following UI events:
|
||||
• `cmdline_show`: `hl_id` to highlight the prompt text.
|
||||
• `cmdline_hide`: `abort` indicating if the cmdline was aborted.
|
||||
• `msg_show`: new message kinds: "bufwrite", "completion", "list_cmd",
|
||||
"lua_print", "number_prompt", "search_cmd", "undo", "wildlist".
|
||||
• New/enhanced arguments in these existing UI events:
|
||||
• `cmdline_show`: `hl_id` argument to highlight the prompt text.
|
||||
• `cmdline_hide`: `abort` argument indicating if the cmdline was aborted.
|
||||
• `msg_show`:
|
||||
• `history` argument indicating if the message was added to the history.
|
||||
• new message kinds: "bufwrite", "completion", "list_cmd",
|
||||
"lua_print", "number_prompt", "search_cmd", "undo", "wildlist".
|
||||
|
||||
HIGHLIGHTS
|
||||
|
||||
|
@ -784,7 +784,7 @@ will be set to zero, but can be changed and used for the replacing cmdline or
|
||||
message window. Cmdline state is emitted as |ui-cmdline| events, which the UI
|
||||
must handle.
|
||||
|
||||
["msg_show", kind, content, replace_last] ~
|
||||
["msg_show", kind, content, replace_last, history] ~
|
||||
Display a message to the user.
|
||||
|
||||
kind
|
||||
@ -827,6 +827,9 @@ must handle.
|
||||
true: Replace the message in the most-recent `msg_show` call,
|
||||
but any other visible message should still remain.
|
||||
|
||||
history
|
||||
True if the message was added to the |:messages| history.
|
||||
|
||||
["msg_clear"] ~
|
||||
Clear all messages currently displayed by "msg_show". (Messages sent
|
||||
by other "msg_" events below will not be affected).
|
||||
|
@ -158,7 +158,7 @@ void wildmenu_select(Integer selected)
|
||||
void wildmenu_hide(void)
|
||||
FUNC_API_SINCE(3) FUNC_API_REMOTE_ONLY;
|
||||
|
||||
void msg_show(String kind, Array content, Boolean replace_last)
|
||||
void msg_show(String kind, Array content, Boolean replace_last, Boolean history)
|
||||
FUNC_API_SINCE(6) FUNC_API_FAST FUNC_API_REMOTE_ONLY;
|
||||
void msg_clear(void)
|
||||
FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY;
|
||||
|
@ -153,6 +153,7 @@ static sattr_T msg_ext_last_attr = -1;
|
||||
static int msg_ext_last_hl_id;
|
||||
static size_t msg_ext_cur_len = 0;
|
||||
|
||||
static bool msg_ext_history = false; ///< message was added to history
|
||||
static bool msg_ext_overwrite = false; ///< will overwrite last message
|
||||
static int msg_ext_visible = 0; ///< number of messages currently visible
|
||||
|
||||
@ -988,7 +989,7 @@ static void add_msg_hist(const char *s, int len, int hl_id, bool multiline)
|
||||
static void add_msg_hist_multihl(const char *s, int len, int hl_id, bool multiline,
|
||||
HlMessage multihl)
|
||||
{
|
||||
if (msg_hist_off || msg_silent != 0) {
|
||||
if (msg_hist_off || msg_silent != 0 || (s != NULL && *s == NUL)) {
|
||||
hl_msg_free(multihl);
|
||||
return;
|
||||
}
|
||||
@ -999,12 +1000,13 @@ static void add_msg_hist_multihl(const char *s, int len, int hl_id, bool multili
|
||||
if (len < 0) {
|
||||
len = (int)strlen(s);
|
||||
}
|
||||
assert(len > 0);
|
||||
// remove leading and trailing newlines
|
||||
while (len > 0 && *s == '\n') {
|
||||
while (*s == '\n') {
|
||||
s++;
|
||||
len--;
|
||||
}
|
||||
while (len > 0 && s[len - 1] == '\n') {
|
||||
while (s[len - 1] == '\n') {
|
||||
len--;
|
||||
}
|
||||
p->msg = xmemdupz(s, (size_t)len);
|
||||
@ -1024,6 +1026,7 @@ static void add_msg_hist_multihl(const char *s, int len, int hl_id, bool multili
|
||||
first_msg_hist = last_msg_hist;
|
||||
}
|
||||
msg_hist_len++;
|
||||
msg_ext_history = true;
|
||||
|
||||
check_msg_hist();
|
||||
}
|
||||
@ -3159,13 +3162,14 @@ void msg_ext_ui_flush(void)
|
||||
msg_ext_emit_chunk();
|
||||
if (msg_ext_chunks->size > 0) {
|
||||
Array *tofree = msg_ext_init_chunks();
|
||||
ui_call_msg_show(cstr_as_string(msg_ext_kind), *tofree, msg_ext_overwrite);
|
||||
ui_call_msg_show(cstr_as_string(msg_ext_kind), *tofree, msg_ext_overwrite, msg_ext_history);
|
||||
api_free_array(*tofree);
|
||||
xfree(tofree);
|
||||
if (!msg_ext_overwrite) {
|
||||
msg_ext_visible++;
|
||||
}
|
||||
msg_ext_overwrite = false;
|
||||
msg_ext_history = false;
|
||||
msg_ext_kind = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -265,6 +265,7 @@ describe('vim.ui_attach', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'E122: Function Foo already exists, add ! to replace it', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'emsg',
|
||||
},
|
||||
},
|
||||
@ -283,6 +284,7 @@ describe('vim.ui_attach', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'replace with Replacement (y/n/a/q/l/^E/^Y)?', 6, 18 } },
|
||||
history = true,
|
||||
kind = 'confirm_sub',
|
||||
},
|
||||
},
|
||||
@ -300,10 +302,12 @@ describe('vim.ui_attach', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Select:\nOne\nTwo\n' } },
|
||||
history = false,
|
||||
kind = 'list_cmd',
|
||||
},
|
||||
{
|
||||
content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } },
|
||||
history = false,
|
||||
kind = 'number_prompt',
|
||||
},
|
||||
},
|
||||
@ -382,6 +386,7 @@ describe('vim.ui_attach', function()
|
||||
6,
|
||||
},
|
||||
},
|
||||
history = true,
|
||||
kind = 'lua_error',
|
||||
},
|
||||
{
|
||||
@ -392,10 +397,12 @@ describe('vim.ui_attach', function()
|
||||
6,
|
||||
},
|
||||
},
|
||||
history = true,
|
||||
kind = 'lua_error',
|
||||
},
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 100, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
|
@ -51,6 +51,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { '\ntest\n[O]k: ', 6, 10 } },
|
||||
history = false,
|
||||
kind = 'confirm',
|
||||
},
|
||||
},
|
||||
@ -80,6 +81,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { '\ntest\n[O]k: ', 6, 10 } },
|
||||
history = false,
|
||||
kind = 'confirm',
|
||||
},
|
||||
},
|
||||
@ -89,14 +91,17 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { '\ntest\n[O]k: ', 6, 10 } },
|
||||
history = false,
|
||||
kind = 'confirm',
|
||||
},
|
||||
{
|
||||
content = { { '1' } },
|
||||
history = false,
|
||||
kind = 'echo',
|
||||
},
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -115,6 +120,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'replace with X (y/n/a/q/l/^E/^Y)?', 6, 18 } },
|
||||
history = true,
|
||||
kind = 'confirm_sub',
|
||||
},
|
||||
},
|
||||
@ -134,6 +140,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'W10: Warning: Changing a readonly file', 19, 26 } },
|
||||
history = true,
|
||||
kind = 'wmsg',
|
||||
},
|
||||
},
|
||||
@ -151,6 +158,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'search hit BOTTOM, continuing at TOP', 19, 26 } },
|
||||
history = true,
|
||||
kind = 'wmsg',
|
||||
},
|
||||
},
|
||||
@ -163,14 +171,17 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Error detected while processing :', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'emsg',
|
||||
},
|
||||
{
|
||||
content = { { 'E605: Exception not caught: foo', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'emsg',
|
||||
},
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -190,6 +201,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { '(2 of 2): line2' } },
|
||||
history = true,
|
||||
kind = 'quickfix',
|
||||
},
|
||||
},
|
||||
@ -204,10 +216,13 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*3
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { '?line ' } },
|
||||
kind = 'search_cmd',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { '?line ' } },
|
||||
history = false,
|
||||
kind = 'search_cmd',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- highlight
|
||||
@ -227,6 +242,7 @@ describe('ui/ext_messages', function()
|
||||
{ 'links to', 18, 5 },
|
||||
{ ' SpecialChar' },
|
||||
},
|
||||
history = false,
|
||||
kind = 'list_cmd',
|
||||
},
|
||||
},
|
||||
@ -242,6 +258,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Already at oldest change' } },
|
||||
history = true,
|
||||
kind = 'undo',
|
||||
},
|
||||
},
|
||||
@ -257,6 +274,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Already at newest change' } },
|
||||
history = true,
|
||||
kind = 'undo',
|
||||
},
|
||||
},
|
||||
@ -269,6 +287,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'The only match' } },
|
||||
history = false,
|
||||
kind = 'completion',
|
||||
},
|
||||
},
|
||||
@ -285,10 +304,13 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'raa', 9, 6 } },
|
||||
kind = 'echoerr',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'raa', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- cmdline in a later input cycle clears error message
|
||||
@ -315,14 +337,17 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
{
|
||||
content = { { 'fail', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -338,18 +363,22 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
{
|
||||
content = { { 'fail', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
{
|
||||
content = { { 'extrafail', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -370,10 +399,13 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
messages = { {
|
||||
content = { { 'problem', 9, 6 } },
|
||||
kind = 'echoerr',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'problem', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
{
|
||||
prompt = 'foo> ',
|
||||
@ -411,6 +443,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -437,6 +470,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork\nfail', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
},
|
||||
@ -452,6 +486,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -477,7 +512,7 @@ describe('ui/ext_messages', function()
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { '/line W [1/2]' } }, kind = 'search_count' },
|
||||
{ content = { { '/line W [1/2]' } }, kind = 'search_count', history = false },
|
||||
},
|
||||
}
|
||||
|
||||
@ -489,7 +524,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*3
|
||||
]],
|
||||
messages = {
|
||||
{ content = { { '/line [2/2]' } }, kind = 'search_count' },
|
||||
{ content = { { '/line [2/2]' } }, kind = 'search_count', history = false },
|
||||
},
|
||||
}
|
||||
end)
|
||||
@ -504,10 +539,11 @@ describe('ui/ext_messages', function()
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { 'x #1' } }, kind = 'list_cmd' },
|
||||
{ content = { { 'y #2' } }, kind = 'list_cmd' },
|
||||
{ content = { { 'x #1' } }, kind = 'list_cmd', history = false },
|
||||
{ content = { { 'y #2' } }, kind = 'list_cmd', history = false },
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -578,10 +614,13 @@ describe('ui/ext_messages', function()
|
||||
items = { { 'alphpabet', '', '', '' }, { 'alphanum', '', '', '' } },
|
||||
pos = 1,
|
||||
},
|
||||
messages = { {
|
||||
content = { { 'stuff' } },
|
||||
kind = 'echomsg',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'stuff' } },
|
||||
history = true,
|
||||
kind = 'echomsg',
|
||||
},
|
||||
},
|
||||
showmode = { { '-- Keyword Local completion (^N^P) ', 5, 11 }, { 'match 1 of 2', 6, 18 } },
|
||||
}
|
||||
|
||||
@ -598,10 +637,13 @@ describe('ui/ext_messages', function()
|
||||
items = { { 'alphpabet', '', '', '' }, { 'alphanum', '', '', '' } },
|
||||
pos = 0,
|
||||
},
|
||||
messages = { {
|
||||
content = { { 'stuff' } },
|
||||
kind = 'echomsg',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'stuff' } },
|
||||
history = true,
|
||||
kind = 'echomsg',
|
||||
},
|
||||
},
|
||||
showmode = { { '-- Keyword Local completion (^N^P) ', 5, 11 }, { 'match 2 of 2', 6, 18 } },
|
||||
}
|
||||
|
||||
@ -621,6 +663,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -813,10 +856,13 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'howdy' } },
|
||||
kind = 'echomsg',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'howdy' } },
|
||||
history = true,
|
||||
kind = 'echomsg',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- always test a message without kind. If this one gets promoted to a
|
||||
@ -830,6 +876,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Type :qa and press <Enter> to exit Nvim' } },
|
||||
history = true,
|
||||
kind = '',
|
||||
},
|
||||
},
|
||||
@ -842,10 +889,13 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'bork', 9, 6 } },
|
||||
kind = 'echoerr',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'bork', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'echoerr',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
feed(':echo "xyz"<cr>')
|
||||
@ -855,10 +905,13 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = { {
|
||||
content = { { 'xyz' } },
|
||||
kind = 'echo',
|
||||
} },
|
||||
messages = {
|
||||
{
|
||||
content = { { 'xyz' } },
|
||||
history = false,
|
||||
kind = 'echo',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
feed(':call nosuchfunction()<cr>')
|
||||
@ -871,6 +924,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'E117: Unknown function: nosuchfunction', 9, 6 } },
|
||||
history = true,
|
||||
kind = 'emsg',
|
||||
},
|
||||
},
|
||||
@ -892,6 +946,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -948,7 +1003,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*4
|
||||
]],
|
||||
cmdline = { {
|
||||
abort = false
|
||||
abort = false,
|
||||
} },
|
||||
})
|
||||
eq(0, eval('&cmdheight'))
|
||||
@ -976,6 +1031,7 @@ stack traceback:
|
||||
6,
|
||||
},
|
||||
},
|
||||
history = true,
|
||||
kind = 'lua_error',
|
||||
},
|
||||
},
|
||||
@ -996,6 +1052,7 @@ stack traceback:
|
||||
content = {
|
||||
{ "Error invoking 'test_method' on channel 1:\ncomplete\nerror\n\nmessage", 9, 6 },
|
||||
},
|
||||
history = true,
|
||||
kind = 'rpc_error',
|
||||
},
|
||||
},
|
||||
@ -1023,6 +1080,7 @@ stack traceback:
|
||||
{ '*', 18, 1 },
|
||||
{ ' k' },
|
||||
},
|
||||
history = false,
|
||||
kind = 'list_cmd',
|
||||
},
|
||||
},
|
||||
@ -1043,6 +1101,7 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { 'wildmenu wildmode' } },
|
||||
history = false,
|
||||
kind = 'wildlist',
|
||||
},
|
||||
},
|
||||
@ -1070,10 +1129,12 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Change "helllo" to:\n 1 "Hello"\n 2 "Hallo"\n 3 "Hullo"\n' } },
|
||||
history = false,
|
||||
kind = 'list_cmd',
|
||||
},
|
||||
{
|
||||
content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } },
|
||||
history = false,
|
||||
kind = 'number_prompt',
|
||||
},
|
||||
},
|
||||
@ -1089,14 +1150,17 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Change "helllo" to:\n 1 "Hello"\n 2 "Hallo"\n 3 "Hullo"\n' } },
|
||||
history = false,
|
||||
kind = 'list_cmd',
|
||||
},
|
||||
{
|
||||
content = { { 'Type number and <Enter> or click with the mouse (q or empty cancels): ' } },
|
||||
history = false,
|
||||
kind = 'number_prompt',
|
||||
},
|
||||
{
|
||||
content = { { '1' } },
|
||||
history = false,
|
||||
kind = '',
|
||||
},
|
||||
},
|
||||
@ -1125,6 +1189,7 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { 'wow, ', 10, 8 }, { 'such\n\nvery ', 9, 6 }, { 'color', 8, 12 } },
|
||||
history = true,
|
||||
kind = 'echomsg',
|
||||
},
|
||||
},
|
||||
@ -1138,7 +1203,11 @@ stack traceback:
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { '\n 1 %a "[No Name]" line 1' } }, kind = 'list_cmd' },
|
||||
{
|
||||
content = { { '\n 1 %a "[No Name]" line 1' } },
|
||||
kind = 'list_cmd',
|
||||
history = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -1152,6 +1221,7 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -1176,7 +1246,11 @@ stack traceback:
|
||||
command('write ' .. fname)
|
||||
screen:expect({
|
||||
messages = {
|
||||
{ content = { { string.format('"%s" [New] 0L, 0B written', fname) } }, kind = 'bufwrite' },
|
||||
{
|
||||
content = { { string.format('"%s" [New] 0L, 0B written', fname) } },
|
||||
kind = 'bufwrite',
|
||||
history = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end)
|
||||
@ -1203,6 +1277,7 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { 'foo\nbar\nbaz' } },
|
||||
history = true,
|
||||
kind = 'lua_print',
|
||||
},
|
||||
},
|
||||
@ -1216,6 +1291,7 @@ stack traceback:
|
||||
messages = {
|
||||
{
|
||||
content = { { '{\n foo = "bar"\n}' } },
|
||||
history = true,
|
||||
kind = 'lua_print',
|
||||
},
|
||||
},
|
||||
@ -1894,6 +1970,7 @@ describe('ui/ext_messages', function()
|
||||
messages = {
|
||||
{
|
||||
content = { { 'Press ENTER or type command to continue', 6, 18 } },
|
||||
history = false,
|
||||
kind = 'return_prompt',
|
||||
},
|
||||
},
|
||||
@ -1975,7 +2052,7 @@ describe('ui/ext_messages', function()
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { ' cmdheight=0' } }, kind = 'list_cmd' },
|
||||
{ content = { { ' cmdheight=0' } }, kind = 'list_cmd', history = false },
|
||||
},
|
||||
})
|
||||
|
||||
@ -1992,7 +2069,7 @@ describe('ui/ext_messages', function()
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { ' laststatus=3' } }, kind = 'list_cmd' },
|
||||
{ content = { { ' laststatus=3' } }, kind = 'list_cmd', history = false },
|
||||
},
|
||||
})
|
||||
|
||||
@ -2013,7 +2090,7 @@ describe('ui/ext_messages', function()
|
||||
]],
|
||||
cmdline = { { abort = false } },
|
||||
messages = {
|
||||
{ content = { { ' cmdheight=0' } }, kind = 'list_cmd' },
|
||||
{ content = { { ' cmdheight=0' } }, kind = 'list_cmd', history = false },
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
@ -1369,12 +1369,12 @@ function Screen:_handle_wildmenu_hide()
|
||||
self.wildmenu_items, self.wildmenu_pos = nil, nil
|
||||
end
|
||||
|
||||
function Screen:_handle_msg_show(kind, chunks, replace_last)
|
||||
function Screen:_handle_msg_show(kind, chunks, replace_last, history)
|
||||
local pos = #self.messages
|
||||
if not replace_last or pos == 0 then
|
||||
pos = pos + 1
|
||||
end
|
||||
self.messages[pos] = { kind = kind, content = chunks }
|
||||
self.messages[pos] = { kind = kind, content = chunks, history = history }
|
||||
end
|
||||
|
||||
function Screen:_handle_msg_clear()
|
||||
@ -1490,7 +1490,11 @@ function Screen:_extstate_repr(attr_state)
|
||||
|
||||
local messages = {}
|
||||
for i, entry in ipairs(self.messages) do
|
||||
messages[i] = { kind = entry.kind, content = self:_chunks_repr(entry.content, attr_state) }
|
||||
messages[i] = {
|
||||
kind = entry.kind,
|
||||
content = self:_chunks_repr(entry.content, attr_state),
|
||||
history = entry.history,
|
||||
}
|
||||
end
|
||||
|
||||
local msg_history = {}
|
||||
|
Reference in New Issue
Block a user