diff --git a/src/commands/README.md b/src/commands/README.md index 68a8e0cc..27dcc5aa 100644 --- a/src/commands/README.md +++ b/src/commands/README.md @@ -860,7 +860,7 @@ This command: -### [`openMenu`](./misc.ts#L309-L331) +### [`openMenu`](./misc.ts#L309-L332) Open menu. @@ -884,7 +884,7 @@ This command: -### [`changeInput`](./misc.ts#L372-L386) +### [`changeInput`](./misc.ts#L373-L387) Change current input. @@ -901,7 +901,7 @@ This command: -### [`ifEmpty`](./misc.ts#L396-L407) +### [`ifEmpty`](./misc.ts#L397-L408) Executes one of the specified commands depending on whether the current selections are empty. diff --git a/src/commands/index.ts b/src/commands/index.ts index c72d20de..5345e8c3 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -54,6 +54,10 @@ export class CommandDescriptor -### [`openMenu`](../misc.ts#L309-L331) +### [`openMenu`](../misc.ts#L309-L332) Open menu. @@ -869,7 +869,7 @@ This command: -### [`changeInput`](../misc.ts#L372-L386) +### [`changeInput`](../misc.ts#L373-L387) Change current input. @@ -886,7 +886,7 @@ This command: -### [`ifEmpty`](../misc.ts#L396-L407) +### [`ifEmpty`](../misc.ts#L397-L408) Executes one of the specified commands depending on whether the current selections are empty. diff --git a/src/commands/layouts/qwerty.md b/src/commands/layouts/qwerty.md index fbd1064a..9fd5c309 100644 --- a/src/commands/layouts/qwerty.md +++ b/src/commands/layouts/qwerty.md @@ -845,7 +845,7 @@ This command: -### [`openMenu`](../misc.ts#L309-L331) +### [`openMenu`](../misc.ts#L309-L332) Open menu. @@ -869,7 +869,7 @@ This command: -### [`changeInput`](../misc.ts#L372-L386) +### [`changeInput`](../misc.ts#L373-L387) Change current input. @@ -886,7 +886,7 @@ This command: -### [`ifEmpty`](../misc.ts#L396-L407) +### [`ifEmpty`](../misc.ts#L397-L408) Executes one of the specified commands depending on whether the current selections are empty. diff --git a/src/commands/load-all.build.ts b/src/commands/load-all.build.ts index dd28d640..ac93b325 100644 --- a/src/commands/load-all.build.ts +++ b/src/commands/load-all.build.ts @@ -226,6 +226,10 @@ function determineFunctionFlags(f: Builder.ParsedFunction) { flags.push("DoNotReplay"); } + if ("keepcontext" in f.properties) { + flags.push("KeepContext"); + } + if (flags.length === 0) { return "CommandDescriptor.Flags.None"; } diff --git a/src/commands/load-all.ts b/src/commands/load-all.ts index 89e96c90..5d17f2b4 100644 --- a/src/commands/load-all.ts +++ b/src/commands/load-all.ts @@ -444,7 +444,7 @@ export const commands: Commands = function () { "dance.openMenu": new CommandDescriptor( "dance.openMenu", (_, argument) => _.runAsync(async (_) => await openMenu(_, getInputOr("menu", argument), argument["prefix"], argument["pass"], argument["locked"], argument["delay"], argument["title"])), - CommandDescriptor.Flags.DoNotReplay, + CommandDescriptor.Flags.DoNotReplay | CommandDescriptor.Flags.KeepContext, ), "dance.run": new CommandDescriptor( "dance.run", diff --git a/src/commands/misc.ts b/src/commands/misc.ts index dfee5eca..ce02915c 100644 --- a/src/commands/misc.ts +++ b/src/commands/misc.ts @@ -318,6 +318,7 @@ const menuHistory: string[] = []; * like `jj`. * * @noreplay + * @keepcontext */ export async function openMenu( _: Context.WithoutActiveEditor, diff --git a/test/suite/utils.ts b/test/suite/utils.ts index 29bd28d6..4c0aa00c 100644 --- a/test/suite/utils.ts +++ b/test/suite/utils.ts @@ -396,6 +396,7 @@ export class ExpectedDocument { end = editor.document.lineAt(editor.document.lineCount - 1).rangeIncludingLineBreak.end; builder.replace(new vscode.Range(start, end), this.text); + builder.setEndOfLine(vscode.EndOfLine.LF); }); if (this.selections.length > 0) {