Shougo / pum.vim

Original popup completion menu framework library
MIT License
110 stars 19 forks source link

When item.word is the same candidates are lined up, insert_relative does not work. #42

Closed uga-rosa closed 1 year ago

uga-rosa commented 1 year ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

The next item cannot be selected and is confirmed.

Expected

Select the next item.

Environment Information (Required!)

Latest

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/ddc.vim
set runtimepath+=/path/to/ddc-ui-pum
set runtimepath+=/path/to/pum.vim

call ddc#custom#patch_global(#{
      \ ui: 'pum',
      \ sources: ['test'],
      \ sourceOptions: #{
      \   _: #{
      \     dup: 'keep'
      \   }
      \ },
      \})

inoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-y> <Cmd>call pum#map#confirm()<CR>
inoremap <C-x> <Cmd>call pum#open(1, [
      \ #{
      \   word: 'text',
      \   kind: 'A',
      \   dup: 1,
      \ }, #{
      \   word: 'text',
      \   kind: 'B',
      \   dup: 1,
      \ }
      \])<CR>

call ddc#enable()

And ddc-source-text

type Params = Record<string, never>;

type UserData = { data: string; };

export class Source extends BaseSource { gather( _args: GatherArguments, ): Promise<DdcGatherItems> { return Promise.resolve({ items: [ { word: "test1", kind: "A", }, { word: "test1", kind: "B", }, ], isIncomplete: false, }); }

params(): Params { return {}; } }



## How to reproduce the problem from neovim/Vim startup (Required!)

1. Insert text `te`
2. Two candidates `test1` come up
3. You try to select one, the popup closes.

FYI:
This issue is related ddc.vim.
After disabling ddc.vim with call `ddc#disable()`, you can confirm that `<C-n>/<C-p>` works correctly by directly hitting `pum#open()` with `<C-x>`.

## Screen shot (if possible)

## Upload the log messages by `:redir` and `:message` (if errored)
Shougo commented 1 year ago

Fixed.

Please update pum.vim.