Shougo / ddu-ui-ff

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

While map `<esc>` immediately after calling "leaveFilterWindow", filter contents become strange. #139

Closed kyoh86 closed 6 months ago

kyoh86 commented 6 months ago

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

Problems summary

I want it to back into normal mode after "leaveFilterWindow" is called, but when I map the <esc> immediately after it, filter buffer behaves that revive the content when I erase it all.

Expected

Never revive when I erase the filter content.

Environment Information

deno 1.43.5 (release, x86_64-unknown-linux-gnu)
v8 12.4.254.13
typescript 5.4.5
NVIM v0.11.0-dev-62eb7e7
Build type: Release
LuaJIT 2.1.1713484068
Run ":verbose version" for more info

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

set rtp+=/path/to/rtp/denops.vim
set rtp+=/path/to/rtp/ddu.vim
set rtp+=/path/to/rtp/ddu-ui-ff
set rtp+=/path/to/rtp/ddu-source-buffer
set rtp+=/path/to/rtp/ddu-filter-matcher_substring

set hidden
new hoge
quit
new fuga
quit

function! s:setup_ddu() abort
  call ddu#custom#patch_global({
        \   "sources": [
        \     {
        \       "name": "buffer",
        \       "options": {
        \         "matchers": ["matcher_substring"],
        \       }
        \     }
        \   ],
        \   "kindOptions": {
        \     "file": {
        \       "defaultAction": "open",
        \     },
        \   },
        \   "ui": "ff",
        \ })
endfunction
autocmd User DenopsPluginPost:ddu call s:setup_ddu()

function! s:keymap_list() abort
  nnoremap <buffer> <silent> <c-f> <cmd>call ddu#ui#do_action("openFilterWindow")<cr>
endfunction
autocmd FileType ddu-ff call s:keymap_list()

function! s:keymap_filter() abort
  inoremap <buffer> <silent> <cr> <cmd>call ddu#ui#do_action("leaveFilterWindow")<cr><esc>
endfunction
autocmd FileType ddu-ff-filter call s:keymap_filter()

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

  1. call ddu#start()
  2. type <c-f> to open filter
  3. type hoge<cr> (then only "hoge" is shown in the list)
  4. type <c-f> to re-open filter
  5. type <bs><bs><bs><bs> (4 times <bs>) to erase filter value
  6. type fuga<cr> (then only "fuga" is shown in the list)
  7. type <c-f> to re-open filter
  8. type <bs><bs><bs><bs> (4 times <bs>) to erase filter value

Then, I expect the filter value is empty, but it is "fuga". And strangely, there are 3 buffers are shown in the list.

If we type more to move cursor or change value of the filter, and repeat <cr> (leaveFilterWindow + <esc>) and openFilterWindow,, it behaves more and more strangely.

Screenshot (if possible)

https://gyazo.com/026f90163bca6f73ba23fcb974f785aa

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

kyoh86 commented 6 months ago

Using closeFilterWindow, same matter happens.

Shougo commented 6 months ago

@kyoh86 Please describe the minimal instruction.

Shougo commented 6 months ago

Well, I should remove current filter window implementation.... It is not stable.

Shougo commented 6 months ago

141 fixes the problem.

Shougo commented 6 months ago

Fixed.