Shougo / ddu-source-action

Action source for ddu.vim
MIT License
5 stars 2 forks source link

Executing chooseAction in floatwin of ui-ff results in commands executed in ff window #2

Closed ogaken-1 closed 11 months ago

ogaken-1 commented 11 months ago

Executing chooseAction in ff's UI, and selecting the open action results in files being opened in the ff window.

https://github.com/Shougo/ddu-source-action/assets/60453380/a111d341-6d4e-43b4-a840-fe2e706bb638

The necessary parts for reproduction are as follows:

Minimal configuration

init.vim

let &rtp = $VIMRUNTIME
const s:packpath = expand('<script>:p:h')
let &packpath = s:packpath
const s:ToPackPath = { name -> s:packpath .. '/pack/github.com/opt/' .. name }

function s:PackAdd(ghrepo) abort
  const plugin = #{
        \ path: s:ToPackPath(a:ghrepo),
        \ repo: $'https://github.com/{a:ghrepo}.git',
        \ name: a:ghrepo,
        \ }
  if !isdirectory(plugin.path)
    call system(['git', 'clone', plugin.repo, plugin.path])
  endif
  exec 'packadd' plugin.name
endfunction

call s:PackAdd('vim-denops/denops.vim')
call s:PackAdd('Shougo/ddu.vim')
call s:PackAdd('Shougo/ddu-ui-ff')
call s:PackAdd('Shougo/ddu-kind-file')
call s:PackAdd('Shougo/ddu-source-action')
call s:PackAdd('Shougo/ddu-source-file')

call ddu#custom#patch_global(#{
      \ ui: 'ff',
      \ uiParams: #{
      \   ff: #{
      \     split: 'floating',
      \   },
      \ },
      \ kindOptions: #{
      \   action: #{
      \     defaultAction: 'do',
      \   },
      \ },
      \ })

command Ddu call ddu#start(#{ sources: [ 'file' ] })

autocmd FileType ddu-ff nnoremap a <Cmd>call ddu#ui#do_action('chooseAction')<CR>
autocmd FileType ddu-ff nnoremap <CR> <Cmd>call ddu#ui#do_action('itemAction')<CR>

Reproduction Steps

  1. Place init.vim at any location
  2. Launch neovim with nvim -u init.vim
  3. Execute :Ddu command
  4. Move the cursor over any file and input a (chooseAction)
  5. Move the cursor over open and input (itemAction: do)
Shougo commented 11 months ago

Reproduced.

Shougo commented 11 months ago

Fixed.