aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases/KeymapUseCase.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/usecases/KeymapUseCase.ts')
-rw-r--r--src/content/usecases/KeymapUseCase.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/content/usecases/KeymapUseCase.ts b/src/content/usecases/KeymapUseCase.ts
index f7de334..fab13f5 100644
--- a/src/content/usecases/KeymapUseCase.ts
+++ b/src/content/usecases/KeymapUseCase.ts
@@ -36,13 +36,13 @@ export default class KeymapUseCase {
}
// eslint-disable-next-line max-statements
- nextOps(key: Key): operations.Operation[] {
+ nextOps(key: Key): { count: number, op: operations.Operation } | null {
let sequence = this.repository.enqueueKey(key);
let baseSequence = sequence.trimNumericPrefix();
if (baseSequence.length() === 1 && this.blacklistKey(key)) {
// ignore if the input starts with black list keys
this.repository.clear();
- return [];
+ return null;
}
let keymaps = this.keymapEntityMap();
@@ -53,21 +53,21 @@ export default class KeymapUseCase {
sequence.length() === matched[0][0].length()) {
// keys are matched with an operation
this.repository.clear();
- return [matched[0][1]];
+ return { count: 1, op: matched[0][1] };
} else if (
baseMatched.length === 1 &&
baseSequence.length() === baseMatched[0][0].length()) {
// keys are matched with an operation with a numeric prefix
this.repository.clear();
- return Array(sequence.repeatCount()).fill(baseMatched[0][1]);
+ return { count: sequence.repeatCount(), op: baseMatched[0][1] };
} else if (matched.length >= 1 || baseMatched.length >= 1) {
// keys are matched with an operation's prefix
- return [];
+ return null;
}
// matched with no operations
this.repository.clear();
- return [];
+ return null;
}
private keymapEntityMap(): [KeySequence, operations.Operation][] {