fix(completion): update submode message when selecting from API (#17022)

This commit is contained in:
zeertzjq
2022-01-28 07:55:10 +08:00
committed by GitHub
parent 815aa9f642
commit 69f37197c0
2 changed files with 52 additions and 0 deletions

View File

@@ -1093,6 +1093,8 @@ check_pum:
// equivalent to selecting the item with a typed key.
if (pum_want.active) {
if (pum_visible()) {
// Set this to NULL so that ins_complete() will update the message.
edit_submode_extra = NULL;
insert_do_complete(s);
if (pum_want.finish) {
// accept the item and stop completion

View File

@@ -26,6 +26,7 @@ describe('ui/ext_popupmenu', function()
[5] = {bold = true, foreground = Screen.colors.SeaGreen},
[6] = {background = Screen.colors.WebGray},
[7] = {background = Screen.colors.LightMagenta},
[8] = {foreground = Screen.colors.Red},
})
source([[
function! TestComplete() abort
@@ -426,6 +427,55 @@ describe('ui/ext_popupmenu', function()
{1:~ }|
{2:-- INSERT --} |
]])
feed('<esc>ddiaa bb cc<cr>')
feed('<c-x><c-n>')
screen:expect([[
aa bb cc |
aa^ |
{6:aa }{1: }|
{7:bb }{1: }|
{7:cc }{1: }|
{1:~ }|
{1:~ }|
{2:-- Keyword Local completion (^N^P) }{5:match 1 of 3} |
]])
feed('<f1>')
screen:expect([[
aa bb cc |
cc^ |
{7:aa }{1: }|
{7:bb }{1: }|
{6:cc }{1: }|
{1:~ }|
{1:~ }|
{2:-- Keyword Local completion (^N^P) }{5:match 3 of 3} |
]])
feed('<f2>')
screen:expect([[
aa bb cc |
cc^ |
{7:aa }{1: }|
{7:bb }{1: }|
{7:cc }{1: }|
{1:~ }|
{1:~ }|
{2:-- Keyword Local completion (^N^P) }{8:Back at original} |
]])
feed('<f3>')
screen:expect([[
aa bb cc |
bb^ |
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{1:~ }|
{2:-- INSERT --} |
]])
end)
local function source_complete_month()