From c9c4abbd3b3fe75f12c2fc314af1aaa6d5ba901d Mon Sep 17 00:00:00 2001 From: kuuote Date: Tue, 31 Oct 2023 22:58:55 +0900 Subject: [PATCH] =?UTF-8?q?=E8=B5=B0=E3=81=A3=E3=81=A6=E3=82=8B=E3=82=BD?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=81=82=E3=81=A3=E3=81=A6=E3=82=82volatile?= =?UTF-8?q?=E5=8A=B9=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=BF=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- denops/ddu/app.ts | 18 ++++++++++++++++++ denops/ddu/ddu.ts | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/denops/ddu/app.ts b/denops/ddu/app.ts index df54bc9..e43b879 100644 --- a/denops/ddu/app.ts +++ b/denops/ddu/app.ts @@ -238,6 +238,24 @@ export function main(denops: Denops) { async redraw(arg1: unknown, arg2: unknown): Promise { queuedName = ensure(arg1, is.String); queuedRedrawOption = ensure(arg2, is.Record) as RedrawOption; + const ddu = getDdu(queuedName); + // Check volatile sources + const volatiles = []; + let index = 0; + for (const sourceArgs of ddu.getSourceArgs()) { + if (sourceArgs[0].volatile) { + volatiles.push(index); + } + index++; + } + if ( + queuedRedrawOption?.refreshItems || + queuedRedrawOption?.updateOptions || + volatiles.length > 0 + ) { + ddu.cancelToRefresh(); + ddu.resetCancelledToRefresh(); + } // NOTE: must be locked await lock.lock(async () => { diff --git a/denops/ddu/ddu.ts b/denops/ddu/ddu.ts index 2822ba9..7787065 100644 --- a/denops/ddu/ddu.ts +++ b/denops/ddu/ddu.ts @@ -787,12 +787,12 @@ export class Ddu { this.resetAbortController(); } - private cancelToRefresh() { + cancelToRefresh() { this.cancelledToRefresh = true; this.abortController.abort("cancelToRefresh"); } - private resetCancelledToRefresh() { + resetCancelledToRefresh() { this.cancelledToRefresh = false; this.resetAbortController(); }