aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/Application.ts7
-rw-r--r--src/content/controllers/KeymapController.ts4
-rw-r--r--src/content/usecases/KeymapUseCase.ts4
-rw-r--r--src/shared/settings/Key.ts2
4 files changed, 16 insertions, 1 deletions
diff --git a/src/content/Application.ts b/src/content/Application.ts
index cfa01fd..fbfeb6d 100644
--- a/src/content/Application.ts
+++ b/src/content/Application.ts
@@ -40,6 +40,7 @@ export default class Application {
run() {
this.routeCommonComponents();
+ this.routeFocusEvents();
if (window.self === window.top) {
this.routeMasterComponents();
}
@@ -118,4 +119,10 @@ export default class Application {
this.settingController.initSettings();
}
+
+ private routeFocusEvents() {
+ window.addEventListener('blur', () => {
+ this.keymapController.onBlurWindow();
+ });
+ }
}
diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts
index f9c2545..639b4a1 100644
--- a/src/content/controllers/KeymapController.ts
+++ b/src/content/controllers/KeymapController.ts
@@ -99,4 +99,8 @@ export default class KeymapController {
}
return true;
}
+
+ onBlurWindow() {
+ this.keymapUseCase.cancel();
+ }
}
diff --git a/src/content/usecases/KeymapUseCase.ts b/src/content/usecases/KeymapUseCase.ts
index 7aa7e92..e02bc48 100644
--- a/src/content/usecases/KeymapUseCase.ts
+++ b/src/content/usecases/KeymapUseCase.ts
@@ -70,6 +70,10 @@ export default class KeymapUseCase {
return null;
}
+ cancel() {
+ this.repository.clear();
+ }
+
private keymapEntityMap(): [KeySequence, operations.Operation][] {
const keymaps = this.settingRepository.get().keymaps.combine(reservedKeymaps);
let entries = keymaps.entries().map(
diff --git a/src/shared/settings/Key.ts b/src/shared/settings/Key.ts
index cfe1e7e..1464e57 100644
--- a/src/shared/settings/Key.ts
+++ b/src/shared/settings/Key.ts
@@ -60,7 +60,7 @@ export default class Key {
}
isDigit(): boolean {
- return digits.includes(this.key);
+ return digits.includes(this.key) && !this.ctrl && !this.alt && !this.meta;
}
equals(key: Key) {