Shougo / ddu-ui-ff

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

`i` is inserted in custom action's `insert()` when `startFilter` is true and it is called from chooseAction. #124

Closed kamecha closed 1 year ago

kamecha commented 1 year ago

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

Problems summary

SSIA

Expected

it is worked as well as not using chooseAction.

Environment Information

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

set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim

set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-ff
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-action
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-kind-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-line

let s:ddu_config_json =<< trim MARK
    {
        "uiParams": {
            "ff": {
                "startFilter": true
            }
        },
        "kindOptions": {
            "action": {
                "defaultAction": "do"
            }
        }
    }
MARK

let s:ddu_config_json = s:ddu_config_json->join('')->json_decode()

call ddu#custom#patch_global(s:ddu_config_json)

function s:unko(args)
    let hoge = input('piyo: ')
    return 0
endfunction

call ddu#custom#action('kind', 'file', 'unko', function('s:unko'))

nnoremap [ddu] <Nop>
nmap <Space>u [ddu]
nmap <silent> [ddu]f <Cmd>call ddu#start({
            \ 'ui': 'ff',
            \ 'sources': [{'name': 'file', 'params': {}}],
            \ })<CR>

autocmd FileType ddu-ff call s:ddu_my_settings()

function! s:ddu_my_settings() abort
    nnoremap <buffer> <CR>
                \ <ESC><Cmd>call ddu#ui#do_action('itemAction')<CR>
    nnoremap <buffer> a
                \ <Cmd>call ddu#ui#do_action('chooseAction')<CR>
endfunction

autocmd FileType ddu-ff-filter call s:ddu_filter_my_settings()

function! s:ddu_filter_my_settings() abort
    inoremap <buffer> <C-l>
                \ <ESC><Cmd>call ddu#ui#ff#do_action('leaveFilterWindow')<CR>
endfunction

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

  1. type <Space> u f to start ddu
  2. type <C-l> to leave filter window
  3. type a to fire chooseAction
  4. move cursor to unko and type <CR> to fire the action
  5. the input window's text is now piyo: i not piyo:

Notes

after the No.5, type <CR> and the ui is not quit. function ref to unko return 0. so it is expected to quit ui after type <CR>.

Screenshot (if possible)

chooseAction

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

kamecha commented 1 year ago

This may be related to the behavior of filter not starting after firing chooseAction.

Shougo commented 1 year ago

Fixed.