Merge pull request #1617 from tridactyl/fix_hint_vimperator_space

hinting.ts: Fix #1615
This commit is contained in:
Oliver Blanthorn 2019-05-29 15:40:43 +01:00 committed by GitHub
commit e04ec2c0c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -704,7 +704,7 @@ function popKey() {
modeState.filterFunc(modeState.filter)
}
/** If key is in hintchars, add it to filtstr and filter */
/** Add key to filtstr and filter */
function pushKey(key) {
// The new key can be used to filter the hints
const originalFilter = modeState.filter
@ -718,6 +718,11 @@ function pushKey(key) {
}
}
/** Just run pushKey(" "). This is needed because ex commands ignore whitespace. */
function pushSpace() {
return pushKey(" ")
}
/** Array of hintable elements in viewport
Elements are hintable if
@ -867,7 +872,9 @@ export function parser(keys: KeyboardEvent[]) {
// Add custom bindings on top of it
Object.assign(keymap, config.get("hintmaps"))
// If the key sequence matches, use this match
const parsed = keyseq.parse(keys, keyseq.mapstrMapToKeyMap(new Map(Object.entries(keymap))))
const parsed = keyseq.parse(keys,
keyseq.mapstrMapToKeyMap(new Map((Object.entries(keymap) as any)
.filter(([key, value]) => value != ""))))
if (parsed.isMatch === true) {
return parsed
}
@ -899,6 +906,7 @@ export function getHintCommands() {
focusRightHint,
selectFocusedHint,
pushKey,
pushSpace,
popKey,
};
};