mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
Merge pull request #2232 from mozbugbox/insert-mode-fixes
Insert mode fixes
This commit is contained in:
commit
8a5411432b
2 changed files with 16 additions and 5 deletions
|
@ -302,7 +302,7 @@ config.getAsync("modeindicator").then(mode => {
|
|||
dom.isTextEditable(document.activeElement) &&
|
||||
!["input", "ignore"].includes(mode)
|
||||
) {
|
||||
statusIndicator.textContent = "insert"
|
||||
result = "insert"
|
||||
// this doesn't work; statusIndicator.style is full of empty string
|
||||
// statusIndicator.style.borderColor = "green !important"
|
||||
// need to fix loss of focus by click: doesn't do anything here.
|
||||
|
@ -310,7 +310,7 @@ config.getAsync("modeindicator").then(mode => {
|
|||
mode === "insert" &&
|
||||
!dom.isTextEditable(document.activeElement)
|
||||
) {
|
||||
statusIndicator.textContent = "normal"
|
||||
result = "normal"
|
||||
// statusIndicator.style.borderColor = "lightgray !important"
|
||||
} else {
|
||||
result = mode
|
||||
|
|
|
@ -106,6 +106,7 @@ function* ParserController() {
|
|||
|
||||
while (true) {
|
||||
let exstr = ""
|
||||
let previousSuffix = null
|
||||
let keyEvents: KeyEventLike[] = []
|
||||
try {
|
||||
while (true) {
|
||||
|
@ -145,6 +146,12 @@ function* ParserController() {
|
|||
contentState.mode = "normal"
|
||||
}
|
||||
|
||||
const newMode = contentState.mode
|
||||
if (newMode !== currentMode) {
|
||||
keyEvents = []
|
||||
previousSuffix = null
|
||||
}
|
||||
|
||||
// Accumulate key events. The parser will cut this
|
||||
// down whenever it's not a valid prefix of a known
|
||||
// binding, so it can't grow indefinitely unless you
|
||||
|
@ -175,14 +182,18 @@ function* ParserController() {
|
|||
} else {
|
||||
keyEvents = response.keys
|
||||
// show current keyEvents as a suffix of the contentState
|
||||
contentState.suffix = keyEvents
|
||||
const suffix = keyEvents
|
||||
.map(x => PrintableKey(x))
|
||||
.join("")
|
||||
logger.debug("suffix: ", contentState.suffix)
|
||||
if (previousSuffix !== suffix) {
|
||||
contentState.suffix = suffix
|
||||
previousSuffix = suffix
|
||||
}
|
||||
logger.debug("suffix: ", suffix)
|
||||
}
|
||||
}
|
||||
controller.acceptExCmd(exstr)
|
||||
contentState.suffix = ""
|
||||
controller.acceptExCmd(exstr)
|
||||
} catch (e) {
|
||||
// Rumsfeldian errors are caught here
|
||||
logger.error("An error occurred in the content controller: ", e)
|
||||
|
|
Loading…
Add table
Reference in a new issue