ext_cmdline: change the content format

This commit is contained in:
Dongdong Zhou 2017-04-28 07:49:45 +01:00 committed by Björn Linse
parent 550651c130
commit daec81ab51
3 changed files with 13 additions and 6 deletions

View File

@ -450,6 +450,8 @@ states might be represented as separate modes.
Leave the cmdline.
["cmdline_show", content, pos, firstc, prompt]
content: List of [highlight group, string]
[["Normal", "t"], ["Search", "est"], ...]
When cmdline_external is set to true, nvim will not draw the cmdline
on the grad, instead nvim will send ui events of the cmdline content
and cursor position to the remote ui. The content is the full content

View File

@ -2731,7 +2731,12 @@ void ui_ext_cmdline_char(int c, int shift)
void ui_ext_cmdline_show(void)
{
Array args = ARRAY_DICT_INIT;
ADD(args, STRING_OBJ(cstr_to_string((char *)(ccline.cmdbuff))));
Array content = ARRAY_DICT_INIT;
Array text = ARRAY_DICT_INIT;
ADD(text, STRING_OBJ(cstr_to_string("Normal")));
ADD(text, STRING_OBJ(cstr_to_string((char *)(ccline.cmdbuff))));
ADD(content, ARRAY_OBJ(text));
ADD(args, ARRAY_OBJ(content));
ADD(args, INTEGER_OBJ(ccline.cmdpos));
if (ccline.cmdfirstc != NUL) {
ADD(args, STRING_OBJ(cstr_to_string((char *)(&ccline.cmdfirstc))));

View File

@ -54,7 +54,7 @@ describe('External command line completion', function()
~ |
|
]], nil, nil, function()
eq("sign", content)
eq({{'Normal', 'sign'}}, content)
eq(4, pos)
end)
@ -66,7 +66,7 @@ describe('External command line completion', function()
~ |
|
]], nil, nil, function()
eq("sign", content)
eq({{'Normal', 'sign'}}, content)
eq(true, shown)
eq(3, pos)
end)
@ -79,7 +79,7 @@ describe('External command line completion', function()
~ |
|
]], nil, nil, function()
eq("sin", content)
eq({{'Normal', 'sin'}}, content)
eq(true, shown)
eq(2, pos)
end)
@ -105,7 +105,7 @@ describe('External command line completion', function()
]], nil, nil, function()
eq(true, shown)
eq("input", prompt)
eq("default", content)
eq({{'Normal', 'default'}}, content)
end)
feed('<cr>')
@ -117,7 +117,7 @@ describe('External command line completion', function()
~ |
|
]], nil, nil, function()
eq("3", content)
eq({{'Normal', '3'}}, content)
eq("\"", char)
eq(1, shift)
end)