aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongdong Zhou <dzhou121@gmail.com>2017-04-28 07:49:45 +0100
committerBjörn Linse <bjorn.linse@gmail.com>2017-10-26 09:35:13 +0200
commitdaec81ab5179c7ce8e3813af556b1e2f05fc59c6 (patch)
tree8eaa16a1efd08a0c827c216b07a5d29b5c256cc6
parent550651c130c014e6c668644273db31dd96be475e (diff)
downloadrneovim-daec81ab5179c7ce8e3813af556b1e2f05fc59c6.tar.gz
rneovim-daec81ab5179c7ce8e3813af556b1e2f05fc59c6.tar.bz2
rneovim-daec81ab5179c7ce8e3813af556b1e2f05fc59c6.zip
ext_cmdline: change the content format
-rw-r--r--runtime/doc/msgpack_rpc.txt2
-rw-r--r--src/nvim/ex_getln.c7
-rw-r--r--test/functional/ui/cmdline_spec.lua10
3 files changed, 13 insertions, 6 deletions
diff --git a/runtime/doc/msgpack_rpc.txt b/runtime/doc/msgpack_rpc.txt
index 46fc6f19c2..ef4a22db0b 100644
--- a/runtime/doc/msgpack_rpc.txt
+++ b/runtime/doc/msgpack_rpc.txt
@@ -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
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 8c9e081c89..12f3f53c81 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -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))));
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 35cacbf4d0..523f7065d4 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -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)