Closed Milly closed 8 months ago
#closeBuffer() is called recursively.
#closeBuffer()
In Vim and using floating,
floating
#closeFilterWindow()
:close
WinClosed
ddu#ui#do_action('quit')
(Maybe) Nothing. But it will cause bugs.
There are many differences, but the reason is indentation.
> git diff -b diff --git a/denops/@ddu-uis/ff.ts b/denops/@ddu-uis/ff.ts index b363689..197d257 100644 --- a/denops/@ddu-uis/ff.ts +++ b/denops/@ddu-uis/ff.ts @@ -175,6 +175,7 @@ export class Ui extends BaseUi<Params> { #restcmd = ""; #prevWinInfo: WinInfo | null = null; #filterBufnr = -1; + #bufferClosing = false; override async onInit(args: { denops: Denops; @@ -1492,6 +1493,12 @@ export class Ui extends BaseUi<Params> { uiParams: Params; cancel: boolean; }): Promise<void> { + if (this.#bufferClosing) { + return; + } + this.#bufferClosing = true; + + try { await this.#previewUi.close(args.denops, args.context, args.uiParams); await this.#previewUi.removePreviewedBuffers(args.denops); const closedFilterWindow = await this.#closeFilterWindow(args.denops); @@ -1598,6 +1605,9 @@ export class Ui extends BaseUi<Params> { } await args.denops.dispatcher.event(args.options.name, "close"); + } finally { + this.#bufferClosing = false; + } } async #getItem(
Problem and actual behavior
#closeBuffer()
is called recursively.In Vim and using
floating
,#closeBuffer()
is called.#closeFilterWindow()
is called in#closeBuffer()
:close
command is called in filter window.WinClosed
autocmd raised andddu#ui#do_action('quit')
is called.#closeBuffer()
is called again before the first call finishes.Defects in actual use
(Maybe) Nothing. But it will cause bugs.
Diff ignoring spaces
There are many differences, but the reason is indentation.