Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Nov 23, 2023
1 parent 69b4a8c commit be6f24f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
33 changes: 33 additions & 0 deletions src/core/model/key-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { LazyKeySpec } from "types/plugin/lazy";

export type TypedKeySpec<
K extends string,
Mode extends string[] = ["n"],
Ft extends string[] | undefined = undefined,
Desc extends string | undefined = undefined,
Silent extends boolean = false,
> = {
lhs: K;
mode: Mode;
ft: Ft;
desc: Desc;
silent: Silent;
};

export function intoKeySpec<
K extends string,
Mode extends string[],
Ft extends string[] | undefined,
Desc extends string | undefined,
Silent extends boolean,
>(
spec: TypedKeySpec<K, Mode, Ft, Desc, Silent>
): Omit<LazyKeySpec, 2> {
return {
[1]: spec.lhs,
mode: spec.mode,
ft: spec.ft,
desc: spec.desc,
silent: spec.silent,
}
}
14 changes: 7 additions & 7 deletions src/core/model/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ export class Plugin<AIds extends string[] = []> {
keySpecs.push(keySpec);
}
}
// for (let action of this.actions) {
// let keys = action.normalizeKeys();
// if (keys.length === 0) continue;
// for (let key of keys) {
// keySpecs.push(key);
// }
// }
for (let action of this.actions) {
let keys = action.normalizeKeys();
if (keys.length === 0) continue;
for (let key of keys) {
keySpecs.push(key);
}
}

let opts = tblExtend("force", this._opts.lazy || {}, {
keys: keySpecs,
Expand Down

0 comments on commit be6f24f

Please sign in to comment.