mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
ext_cmdline: fix inputsecret()
This commit is contained in:
@@ -2733,7 +2733,18 @@ draw_cmdline_no_arabicshape:
|
||||
static void ui_ext_cmdline_show(CmdlineInfo *line)
|
||||
{
|
||||
Array content = ARRAY_DICT_INIT;
|
||||
if (kv_size(line->last_colors.colors)) {
|
||||
if (cmdline_star) {
|
||||
size_t len = 0;
|
||||
for (char_u *p = ccline.cmdbuff; *p; mb_ptr_adv(p)) {
|
||||
len++;
|
||||
}
|
||||
char *buf = xmallocz(len);
|
||||
memset(buf, '*', len);
|
||||
Array item = ARRAY_DICT_INIT;
|
||||
ADD(item, DICTIONARY_OBJ((Dictionary)ARRAY_DICT_INIT));
|
||||
ADD(item, STRING_OBJ(((String) { .data = buf, .size = len })));
|
||||
ADD(content, ARRAY_OBJ(item));
|
||||
} else if (kv_size(line->last_colors.colors)) {
|
||||
for (size_t i = 0; i < kv_size(line->last_colors.colors); i++) {
|
||||
CmdlineColorChunk chunk = kv_A(line->last_colors.colors, i);
|
||||
Array item = ARRAY_DICT_INIT;
|
||||
|
@@ -15,6 +15,7 @@ describe('external cmdline', function()
|
||||
|
||||
before_each(function()
|
||||
clear()
|
||||
cmdline, block = {}, nil
|
||||
screen = Screen.new(25, 5)
|
||||
screen:attach({rgb=true, ext_cmdline=true})
|
||||
screen:set_on_event_handler(function(name, data)
|
||||
@@ -457,6 +458,25 @@ describe('external cmdline', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('works with inputsecret()', function()
|
||||
feed(":call inputsecret('secret:')<cr>abc123")
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]], nil, nil, function()
|
||||
eq({{
|
||||
content = { { {}, "******" } },
|
||||
firstc = "",
|
||||
indent = 0,
|
||||
pos = 6,
|
||||
prompt = "secret:"
|
||||
}}, cmdline)
|
||||
end)
|
||||
end)
|
||||
|
||||
it('works with highlighted cmdline', function()
|
||||
source([[
|
||||
highlight RBP1 guibg=Red
|
||||
|
Reference in New Issue
Block a user