mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
WIP: show possible matches in mode indicator
This commit is contained in:
parent
cef4c3f5d2
commit
9ba2471ce0
2 changed files with 13 additions and 4 deletions
|
@ -11,6 +11,7 @@ const logger = new Logger("controller")
|
|||
|
||||
function PrintableKey(k) {
|
||||
let result = k.key
|
||||
console.log(k)
|
||||
if (
|
||||
result === "Control" ||
|
||||
result === "Meta" ||
|
||||
|
@ -156,10 +157,17 @@ function* ParserController() {
|
|||
exstr = response.exstr
|
||||
break
|
||||
} else {
|
||||
keyEvents = response.keys
|
||||
keyEvents = response.potMatches
|
||||
console.log([...keyEvents.keys()])
|
||||
// show current keyEvents as a suffix of the contentState
|
||||
contentState.suffix = keyEvents
|
||||
.map(x => PrintableKey(x))
|
||||
contentState.suffix = [...keyEvents.keys()]
|
||||
.map(y => {
|
||||
console.log(y)
|
||||
; (y as any).map(x => {
|
||||
console.log(x)
|
||||
PrintableKey(x.key)
|
||||
}).join(" ")
|
||||
})
|
||||
.join("")
|
||||
logger.debug("suffix: ", contentState.suffix)
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ export interface ParserResponse {
|
|||
exstr?: any
|
||||
isMatch: boolean
|
||||
numericPrefix?: number
|
||||
potMatches?: KeyMap
|
||||
}
|
||||
|
||||
export function parse(keyseq: KeyEventLike[], map: KeyMap): ParserResponse {
|
||||
|
@ -156,7 +157,7 @@ export function parse(keyseq: KeyEventLike[], map: KeyMap): ParserResponse {
|
|||
// command, numericPrefix is a numeric prefix of that. We want to
|
||||
// preserve that whole thing, so concat them back together before
|
||||
// returning.
|
||||
return { keys: numericPrefix.concat(keyseq), isMatch: keyseq.length > 0 }
|
||||
return { keys: numericPrefix.concat(keyseq), isMatch: keyseq.length > 0, potMatches: possibleMappings }
|
||||
}
|
||||
|
||||
/** True if seq1 is a prefix or equal to seq2 */
|
||||
|
|
Loading…
Add table
Reference in a new issue