Implicitly convert menu item args to arrays in dance.openMenu (fixes #177).

This commit is contained in:
Grégoire Geis 2021-06-18 19:41:14 +02:00
parent 597be1e3d5
commit c1b33ba301
3 changed files with 10 additions and 9 deletions

View File

@ -34,11 +34,4 @@
},
},
},
"spellright.language": [
"en"
],
"spellright.documentTypes": [
"latex",
"plaintext"
],
}

View File

@ -159,14 +159,20 @@ export namespace showLockedMenu {
function mergeArgs(args: readonly any[] | undefined, additionalArgs: readonly any[]) {
if (args == null) {
return additionalArgs;
} else if (additionalArgs.length > 0) {
}
if (!Array.isArray(args)) {
args = [args];
}
if (additionalArgs.length > 0) {
return args.length > additionalArgs.length
? args.map((arg, i) =>
i < additionalArgs.length && additionalArgs[i]
? Object.assign({}, additionalArgs[i], arg)
: arg)
: additionalArgs.map((arg, i) =>
i < args.length ? Object.assign({}, arg, args[i]) : arg);
i < args!.length ? Object.assign({}, arg, args![i]) : arg);
} else {
return args;
}

View File

@ -779,6 +779,8 @@ export namespace Recorder {
* succeeded or `false` if the current record is the first one available.
*/
public previous(): this is Cursor<Entry.Any> {
assert(this._offset >= 0);
if (this._offset === 0) {
if (this._bufferIdx === 0) {
return false;