Shougo / ddu-ui-ff

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

Opening a file when auto preview and floating window are set prevents writing to the file. #107

Closed nekowasabi closed 1 year ago

nekowasabi commented 1 year ago

Problems summary

In the windows vim environment, if the auto preview function and the floating window setting are set at the same time, the file will not be writable when opened.

Note: The probability of this occurring is about 10% to 20%.

Expected

Even with auto preview and floating window settings, the file should be writable when opened.

Environment Information

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

if &compatible
  set nocompatible               " Be iMproved
endif

set runtimepath+=~/path/to/denops.vim
set runtimepath+=~/path/to/ddu.vim
set runtimepath+=~/path/to/ddu-ui-ff
set runtimepath+=~/path/to/ddu-kind-file
set runtimepath+=~/path/to/ddu-filter-matcher_substring
set runtimepath+=~/path/to/ddu-source-file

call ddu#custom#patch_global(#{
      \   ui: 'ff',
      \ })

call ddu#custom#patch_global(#{
      \   uiParams: #{
      \     ff: #{
      \         startFilter: v:true,
      \         split: 'floating',
      \         prompt: '> ' ,
      \         filterSplitDirection: 'floating',
      \         filterFloatingPosition: 'top',
      \         highlights: #{filterText: 'Statement', floating: "Normal", floatingBorder: "Special"},
      \         floatingBorder: 'single',
      \         autoAction: #{name: "preview"},
      \         startAutoAction: v:true,
      \         previewFloating: v:true,
      \         floatingTitle: '',
      \         previewSplit: 'vertical',
      \     }
      \   },
      \ })

call ddu#custom#patch_global(#{
    \   kindOptions: #{
    \     file: #{
    \       defaultAction: 'open',
    \     },
    \   }
    \ })

call ddu#custom#patch_global(#{
    \   sourceOptions: #{
    \     _: #{
    \       matchers: ['matcher_substring'],
    \     },
    \   }
    \ })

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()
function! s:ddu_filter_my_settings() abort
  nnoremap <buffer><silent> q
  \ <Cmd>close<CR>
  nnorema <buffer><silent> <CR>
        \ <Cmd>call ddu#ui#ff#do_action('itemAction')<CR>
  nnoremap <buffer><silent> <Space>
        \ <Cmd>call ddu#ui#ff#do_action('toggleSelectItem')<CR>
  nnoremap <buffer><silent> i
        \ <Cmd>call ddu#ui#ff#do_action('openFilterWindow')<CR>
  nnoremap <buffer><silent> q
        \<Cmd>call ddu#ui#ff#do_action('quit')<CR>
endfunction

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

  1. boot windows gvim.
  2. execute `cd ~/', for moving to home directory. This is needed to open vimrc in ddu.
  3. execute call ddu#start({'sources': [{'name': 'file'}]}) in command line.
  4. wait displaying ddu's window by floating window feature.
  5. type vimrc and wait for the candidates to narrow down
  6. type <CR> for opening vimrc file.
  7. execute :w<CR> in command line.
  8. Cause msg E382

Screenshot (if possible)

The sample video uses bugreport.vim as an example, but the vimrc specified in the reproduction procedure above will also occur with a certain probability.

ddu_screenshot

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

Shougo commented 1 year ago

Hm... something wrong.

Shougo commented 1 year ago

Please test the latest version of ddu-ui-ff.

nekowasabi commented 1 year ago

Thanks for the correction. We checked the operation, but it did not work as intended (the same phenomenon as in the video is reproduced).

Shougo commented 1 year ago

Reproduced. It seems another problem.

Shougo commented 1 year ago

It is the bug of ddu-kind-file. I will fix it.

Shougo commented 1 year ago

Fixed. Please update ddu-kind-file.

nekowasabi commented 1 year ago

@Shougo Thank you.

The file can now be written. However, the buffer selected from ddu is now opened in filterWindow. The vim environment and initial settings are the same as above.

ddu_screenshot

Shougo commented 1 year ago

Reproduced. It seems from ddu's recent changes.

Shougo commented 1 year ago

Fixed.

nekowasabi commented 1 year ago

Note: Just a reminder, no need to correct this report, no problem!

We have found a similar phenomenon and report it. When kind is open and the candidate that is narrowed down is not a file or buffer (ddu-source-line is used in the video), The error message is different from the error you fixed. The reproduction condition is to add set runtimepath+=~/path/to/ddu-source-line to the minimum configuration vimrc, The only requirement is to change the ddu command to be executed to call ddu#start({'sources': [{'name': 'line'}]}).

ddu_screenshot

Shougo commented 1 year ago

It is another issue. Please don't reuse the issue.

nekowasabi commented 1 year ago

Issue move to https://github.com/Shougo/ddu-ui-ff/issues/108