Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions content_scripts/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ Commands = {
"j": "moveDown",
"h": "moveLeft",
"l": "moveRight",
"up": "moveUp",
"down": "moveDown",
"left": "moveLeft",
"right": "moveRight",

// Row & column movement
"<C-J>": "moveRowsDown",
Expand Down
13 changes: 13 additions & 0 deletions content_scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,21 @@ UI = {
this.keyQueue = [];
this.cancelEvent(e);
Commands.commands[commandName].fn();
return;
}
}

// Cancel the event if the mode matches "normal" or "visual*",
// to prevent accidentally input an unassigned character like "w" or "b".
// Ensure that the key is not pressed with ctrl or meta,
// not to mask Google Sheets' default shortcuts such as ⌘-F.
if (
!e.ctrlKey &&
!e.metaKey &&
["normal", "visual", "visualLine", "visualColumn"].includes(this.mode)
) {
this.cancelEvent(e);
}
},

// modifiers: optiona; an object with these boolean properties: meta, shift, control.
Expand Down