Merge pull request #1655 from tridactyl/fix-commandline-races

Don't send ex.* excmds around the houses
This commit is contained in:
Oliver Blanthorn 2019-06-04 11:57:35 +01:00 committed by GitHub
commit 8b112f2d0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -171,6 +171,12 @@ commandline_state.clInput.addEventListener(
commandline_state.keyEvents = []
history_called = false
// If excmds start with 'ex.' they're coming back to us anyway, so skip that.
if (response.exstr.startsWith("ex.")) {
const funcname = response.exstr.slice(3)
commandline_state.fns[funcname]()
prev_cmd_called_history = history_called
} else {
// Send excmds directly to our own tab, which fixes the
// old bug where a command would be issued in one tab but
// land in another because the active tab had
@ -182,6 +188,7 @@ commandline_state.clInput.addEventListener(
Messaging.messageOwnTab("controller_content", "acceptExCmd", [
response.exstr,
]).then(_ => (prev_cmd_called_history = history_called))
}
} else {
commandline_state.keyEvents = response.keys
}