ext_cmdline: fix firstc, change cmdline_leave to cmdline_hide

This commit is contained in:
Dongdong Zhou 2017-05-11 04:48:59 +01:00 committed by Björn Linse
parent daec81ab51
commit e164ba41c8
3 changed files with 11 additions and 14 deletions

View File

@ -446,8 +446,8 @@ states might be represented as separate modes.
["cmdline_enter"]
Enter the cmdline.
["cmdline_leave"]
Leave the cmdline.
["cmdline_hide"]
Hide the cmdline.
["cmdline_show", content, pos, firstc, prompt]
content: List of [highlight group, string]

View File

@ -1837,7 +1837,7 @@ getcmdline (
char_u *p = command_line_enter(firstc, count, indent);
if (ui_is_external(kUICmdline)) {
Array args = ARRAY_DICT_INIT;
ui_event("cmdline_leave", args);
ui_event("cmdline_hide", args);
}
return p;
}
@ -2738,16 +2738,13 @@ void ui_ext_cmdline_show(void)
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))));
} else {
ADD(args, STRING_OBJ(cstr_to_string("")));
}
if (ccline.cmdprompt != NULL) {
ADD(args, STRING_OBJ(cstr_to_string((char *)(ccline.cmdprompt))));
} else {
ADD(args, STRING_OBJ(cstr_to_string("")));
}
char *firstc = (char []) { (char)ccline.cmdfirstc };
String str = (String) {
.data = xmemdupz(firstc, 1),
.size = 1
};
ADD(args, STRING_OBJ(str));
ADD(args, STRING_OBJ(cstr_to_string((char *)(ccline.cmdprompt))));
ui_event("cmdline_show", args);
}

View File

@ -16,7 +16,7 @@ describe('External command line completion', function()
screen:set_on_event_handler(function(name, data)
if name == "cmdline_enter" then
shown = true
elseif name == "cmdline_leave" then
elseif name == "cmdline_hide" then
shown = false
elseif name == "cmdline_show" then
content, pos, firstc, prompt = unpack(data)