Shougo / ddu-ui-ff

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

TerminalPreviewer shows the preview in both of the preview window and ff window #111

Closed kyoh86 closed 1 year ago

kyoh86 commented 1 year ago

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

Problems summary

Using the kind it returns TerminalPreviewer as Previewer, "Preview" action is called, ui-ff shows the result in both of the preview window and the ff window.

Expected

It only shows the result in the preview window.

Environment Information

Build type: Release
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info

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

set rtp+=~/path/to/denops.vim
set rtp+=~/path/to/ddu.vim
set rtp+=~/path/to/ddu-ui-ff
set rtp+=~/path/to/dummy

call ddu#custom#patch_global(#{
      \   ui: "ff",
      \   sources: [#{name: "dummy"}],
      \ })

And prepare a dummy source & dummy kind

~/path/to/dummy/denops/@ddu-sources/dummy.ts

import type { GatherArguments } from "https://deno.land/x/ddu_vim@v3.4.3/base/source.ts";
import { BaseSource, Item } from "https://deno.land/x/ddu_vim@v3.4.3/types.ts";

type Params = Record<never,never>;
type ActionData = Record<never,never>;

export class Source extends BaseSource<Params, ActionData> {
  override kind = "dummy";

  override gather({ denops, sourceParams }: GatherArguments<Params>) {
    return new ReadableStream<Item<ActionData>[]>({
      async start(controller) {
        controller.enqueue([{
          word: "foo",
        }])
        controller.close()
      },
    });
  }

  override params(): Params {
    return {};
  }
}

~/path/to/dummy/denops/@ddu-kinds/dummy.ts

import {
  BaseKind,
  Previewer,
} from "https://deno.land/x/ddu_vim@v3.4.3/types.ts";

type Params = Record<never, never>;

export class Kind extends BaseKind<Params> {
  override actions = {};

  getPreviewer(): Promise<Previewer | undefined> {
    return Promise.resolve({
      kind: "terminal",
      cmds: ["echo", "bar"],
    });
  }

  params(): Params {
    return {};
  }
}

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

  1. :call ddu#start()
  2. :call ddu#ui#do_action("preview")

Screenshot (if possible)

image

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

Shougo commented 1 year ago

Fixed.

kyoh86 commented 1 year ago

Thanks! I have checked it is fixed!