Skip to content

Commit

Permalink
feat!: item actions can close UI when all items are gathered.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jul 11, 2023
1 parent 66998c4 commit 06ea977
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export class Ddu {
uiOptions,
uiParams,
);
this.context.doneUi = true;
return;
}
} else {
Expand Down Expand Up @@ -482,6 +483,7 @@ export class Ddu {

// Update current input
this.context.done = true;
this.context.doneUi = false;
this.context.input = this.input;
this.context.maxItems = 0;

Expand Down Expand Up @@ -607,6 +609,8 @@ export class Ddu {
}

await this.uiRedraw(denops, searchTargetItem);

this.context.doneUi = this.context.done;
}

async uiRedraw(
Expand Down Expand Up @@ -919,6 +923,12 @@ export class Ddu {
}

if (actionOptions.quit) {
// NOTE: To quit UI properly, all items must be gathered.
if (!this.context.doneUi) {
echo(denops, "Current ddu UI is not done");
return;
}

// Quit UI before action
await this.uiQuit(denops, ui, uiOptions, uiParams);
}
Expand Down Expand Up @@ -2016,6 +2026,7 @@ async function uiRedraw<
const context = ddu.getContext();
try {
if (ddu.shouldStopCurrentContext()) {
await ddu.uiQuit(denops, ui, uiOptions, uiParams);
return;
}

Expand Down
1 change: 1 addition & 0 deletions denops/ddu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type Context = {
bufName: string;
bufNr: number;
done: boolean;
doneUi: boolean;
input: string;
maxItems: number;
mode: string;
Expand Down
3 changes: 3 additions & 0 deletions doc/ddu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,9 @@ A: The example is here. >
==============================================================================
COMPATIBILITY *ddu-compatibility*

2023.07.11
* item actions can close UI when all items are gathered.

2023.07.07
* Vim 9.0.1276+ or neovim 0.8+ is required to support the latest MacVim.

Expand Down

0 comments on commit 06ea977

Please sign in to comment.