mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -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) {
|
function PrintableKey(k) {
|
||||||
let result = k.key
|
let result = k.key
|
||||||
|
console.log(k)
|
||||||
if (
|
if (
|
||||||
result === "Control" ||
|
result === "Control" ||
|
||||||
result === "Meta" ||
|
result === "Meta" ||
|
||||||
|
@ -156,10 +157,17 @@ function* ParserController() {
|
||||||
exstr = response.exstr
|
exstr = response.exstr
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
keyEvents = response.keys
|
keyEvents = response.potMatches
|
||||||
|
console.log([...keyEvents.keys()])
|
||||||
// show current keyEvents as a suffix of the contentState
|
// show current keyEvents as a suffix of the contentState
|
||||||
contentState.suffix = keyEvents
|
contentState.suffix = [...keyEvents.keys()]
|
||||||
.map(x => PrintableKey(x))
|
.map(y => {
|
||||||
|
console.log(y)
|
||||||
|
; (y as any).map(x => {
|
||||||
|
console.log(x)
|
||||||
|
PrintableKey(x.key)
|
||||||
|
}).join(" ")
|
||||||
|
})
|
||||||
.join("")
|
.join("")
|
||||||
logger.debug("suffix: ", contentState.suffix)
|
logger.debug("suffix: ", contentState.suffix)
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,7 @@ export interface ParserResponse {
|
||||||
exstr?: any
|
exstr?: any
|
||||||
isMatch: boolean
|
isMatch: boolean
|
||||||
numericPrefix?: number
|
numericPrefix?: number
|
||||||
|
potMatches?: KeyMap
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parse(keyseq: KeyEventLike[], map: KeyMap): ParserResponse {
|
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
|
// command, numericPrefix is a numeric prefix of that. We want to
|
||||||
// preserve that whole thing, so concat them back together before
|
// preserve that whole thing, so concat them back together before
|
||||||
// returning.
|
// 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 */
|
/** True if seq1 is a prefix or equal to seq2 */
|
||||||
|
|
Loading…
Add table
Reference in a new issue