Shougo / ddu-ui-ff

Fuzzy finder UI for ddu.vim
MIT License
55 stars 26 forks source link

Any first keystroke inside the filter being discarded after resuming with startFilter #125

Closed creasty closed 11 months ago

creasty commented 11 months ago

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

Problems summary

As per the title.

Here's the commit range obtained from dein's log: https://github.com/Shougo/ddu-ui-ff/compare/c45fd238b91325c53563d3f71dac6c90f9bef025...a3a0d656c739550c0e1081041a76bda4af987a5f

Expected

Environment Information

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

if has('vim_starting')
  let s:config_path = stdpath('config')
  for s:repo in [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'matsui54/ddu-filter-fzy',
  \ ]
    let s:path = s:config_path . '/dein/repos/github.com/' . s:repo
    let &g:rtp .= ',' . s:path
  endfor
endif

call ddu#custom#patch_global({
  \ 'ui': 'ff',
  \ 'uiParams': {
    \ 'ff': {
      \ 'split': 'floating',
      \ 'filterSplitDirection': 'floating',
    \ },
  \ },
  \ 'sourceOptions': {
    \ 'ghq': {
      \ 'matchers': ['matcher_fzy'],
    \ },
  \ },
\ })

command! Open call s:open()
function! s:open() abort
  call ddu#start({
    \ 'name': 'ghq',
    \ 'sources': [{ 'name': 'ghq' }],
    \ 'uiParams': { 'ff': { 'startFilter': v:true } },
    \ 'resume': v:true,
  \ })
endfunction

augroup _init_ddu
  autocmd!
  autocmd FileType ddu-ff call <SID>init_ddu()
  autocmd FileType ddu-ff-filter call <SID>init_ddu()
augroup END

function! s:init_ddu() abort
  nnoremap <buffer> <Esc> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> q <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  nnoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>
  inoremap <buffer> <C-q> <Cmd>call ddu#ui#ff#do_action('quit')<CR>

  nnoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <CR> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  inoremap <buffer> <C-j> <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>

  if &filetype ==# 'ddu-ff'
    setl cursorline
  endif
  if &filetype ==# 'ddu-ff-filter'
    inoremap <buffer> <C-p> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')-1,0)<Bar>redraw")<CR>
    inoremap <buffer> <C-n> <Cmd>call ddu#ui#ff#execute("call cursor(line('.')+1,0)<Bar>redraw")<CR>
  endif
endfunction

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

  1. :Open to open ddu
  2. <C-q> to close ddu
  3. :Open to resume ddu
  4. Any first keystroke inside the filter is discarded
    • For example, just type j; The letter j is supposed to be inserted, but, nothing happens.

Screenshot (if possible)

After the second :Open, I typed j twice. Also, pay attention to how the shape of the cursor changed after I typed the first j.

https://github.com/Shougo/ddu-ui-ff/assets/1695538/29f5c88e-f896-44f4-a436-c0be0cc1f60c

Upload the log messages by :redir and :message (if errored)

Shougo commented 11 months ago

Oh. no. I should remove the option. Because it is hard to implement properly.

Shougo commented 11 months ago

I have changed the behavior because of this.

https://github.com/Shougo/ddu-ui-ff/issues/124

But another problem is occur.

Shougo commented 11 months ago

Fixed.

creasty commented 11 months ago

Thank you as always.