Shougo / ddu-ui-ff

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

Existing window is cleared when invoke any action with chooseAction UI #29

Closed Bakudankun closed 2 years ago

Bakudankun commented 2 years ago

Steps to reproduce

  1. Install next plugins
    • denops.vim
    • ddu.vim
    • ddu-ui-ff
    • ddu-source-action
    • ddu-source-file
    • ddu-kind-file
  2. Start vim
  3. :edit any file
  4. :call ddu#custom#set_global(#{ui: 'ff'})
  5. :call ddu#start(#{sources: [#{name: 'file'}]})
  6. Place cursor on a directory and :call ddu#ui#ff#do_action('chooseAction')
  7. Place cursor on cd and :call ddu#ui#ff#do_action('itemAction', #{name: 'do'})
  8. The first window which had a buffer (at step 3) is cleared and starts editing "No Name" buffer, just like :enew is executed at that window

Whatever action you select at step 7, the same thing will occur.

Expected behaviour

The windows is not cleared; just do what is selected at step 7 (closing the FF UI).

Additional information

This problem was resolved when I tried next patch. I don't know whether it has any side effects, but I didn't find one.

diff --git a/denops/@ddu-uis/ff.ts b/denops/@ddu-uis/ff.ts
index 7f2c47f..4caaaa8 100644
--- a/denops/@ddu-uis/ff.ts
+++ b/denops/@ddu-uis/ff.ts
@@ -309,7 +309,7 @@ export class Ui extends BaseUi<Params> {
     }

     if ((await fn.winnr(args.denops, "$")) == 1) {
-      await args.denops.cmd("enew");
+      await args.denops.cmd(`buffer ${args.context.bufNr}`);
     } else {
       await args.denops.cmd("close!");
       await fn.win_gotoid(args.denops, args.context.winId);

Environment

Shougo commented 2 years ago

OK. I have fixed.