Skip to content

Commit a449bd8

Browse files
authored
Merge pull request #184 from televator-apps/normal-insert-mode-popup
Show HUD on entering normal or insert mode
2 parents 6200b3d + 600f4bf commit a449bd8

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Changelog
66
* Update Vimari interface to allow users access to their configuration.
77
* Remove `closeTabReverse` action.
88
* Normal mode now isolates keybindings from the underlying website, this means that to interact with the underlying website you need to enter insert mode.
9-
* You can enter insert mode by pressing <kbd>i</kbd> and exit the mode by pressing <kbd>esc</kbd>.
9+
* You can enter insert mode by pressing <kbd>i</kbd> and exit the mode by pressing <kbd>esc</kbd>. Activating either mode will display the HUD.
1010
* In insert mode Vimari keybindings are disabled (except for <kbd>esc</kbd> which brings you back to normal mode) allowing you to interact with the underlying website.
1111
* Add `goToFirstInput` action on <kbd>g i</kbd> by default (by [isundaylee](https://github.com/isundaylee)).
1212

Vimari Extension/js/injected.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,26 @@ function enterNormalMode() {
184184
// Clear link hints (if any)
185185
deactivateLinkHintsMode();
186186

187+
188+
if (insertMode === false) {
189+
return // We are already in normal mode.
190+
}
191+
187192
// Re-enable if in insert mode
188193
insertMode = false;
194+
HUD.showForDuration('Normal Mode', hudDuration);
195+
189196
Mousetrap.bind('i', enterInsertMode);
190197
}
191198

192199
// Calling it 'insert mode', but it's really just a user-triggered
193200
// off switch for the actions.
194201
function enterInsertMode() {
195-
insertMode = true;
202+
if (insertMode === true) {
203+
return // We are already in insert mode.
204+
}
205+
insertMode = true;
206+
HUD.showForDuration('Insert Mode', hudDuration);
196207
Mousetrap.unbind('i');
197208
}
198209

0 commit comments

Comments
 (0)