Change logs to debug and use snake case for cl_input_focused message

This commit is contained in:
petoncle 2023-10-28 16:31:24 +02:00
parent 256da68c70
commit ad6eb518ec
5 changed files with 12 additions and 13 deletions

View file

@ -162,13 +162,13 @@ const noblur = () => setTimeout(() => commandline_state.clInput.focus(), 0)
/** @hidden **/
export function focus() {
logger.info("Called focus() after 2000ms")
Messaging.messageOwnTab("clInputFocused", "unused")
logger.debug("Called focus()")
Messaging.messageOwnTab("cl_input_focused", "unused")
commandline_state.clInput.focus()
commandline_state.clInput.removeEventListener("blur", noblur)
commandline_state.clInput.addEventListener("blur", noblur)
if (keysFromContentProcess.length !== 0) {
logger.info("Dispatching " + JSON.stringify(keysFromContentProcess));
logger.debug("Dispatching " + JSON.stringify(keysFromContentProcess));
keysFromContentProcess.forEach(key => commandline_state.clInput.value += key)
keysFromContentProcess = []
}
@ -176,7 +176,7 @@ export function focus() {
let keysFromContentProcess: string[] = []
export function bufferUntilClInputFocused([key]) {
logger.info("Received keyboardEvent for buffering " + key)
logger.debug("Received keyboardEvent for buffering " + key)
if (window.document.activeElement === commandline_state.clInput) {
commandline_state.clInput.value += key
}
@ -200,7 +200,6 @@ let prev_cmd_called_history = false
// Save programmer time by generating an immediately resolved promise
// eslint-disable-next-line @typescript-eslint/no-empty-function
const QUEUE: Promise<any>[] = [(async () => {})()]
logger.info("Setting event listeners of commandline_state.clInput")
/** @hidden **/
commandline_state.clInput.addEventListener(

View file

@ -63,7 +63,7 @@ export function show(hidehover = false) {
*
* Inspired by VVimpulation: https://github.com/amedama41/vvimpulation/commit/53065d015d1e9a892496619b51be83771f57b3d5
*/
logger.info("Called show()")
logger.debug("Called show()")
if (hidehover) {
const a = window.document.createElement("A")
;(a as any).href = ""

View file

@ -193,7 +193,7 @@ function* ParserController() {
if (response.exstr) {
exstr = response.exstr
if (exstr.startsWith("fillcmdline ")) {
logger.info("Setting bufferUntilClInputFocused to true")
logger.debug("Setting bufferUntilClInputFocused to true")
bufferUntilClInputFocused = true
}
break
@ -216,8 +216,8 @@ function* ParserController() {
}
}
}
Messaging.addListener("clInputFocused", () => {
logger.info("Callback clInputFocused")
Messaging.addListener("cl_input_focused", () => {
logger.debug("Callback cl_input_focused")
bufferUntilClInputFocused = false
})
let bufferUntilClInputFocused: boolean = false
@ -226,12 +226,12 @@ generator.next()
/** Feed keys to the ParserController */
export function acceptKey(keyevent: KeyboardEvent) {
logger.info("bufferUntilClInputFocused = " + bufferUntilClInputFocused)
logger.debug("bufferUntilClInputFocused = " + bufferUntilClInputFocused)
if (bufferUntilClInputFocused) {
let isCharacterKey = keyevent.key.length == 1
&& !keyevent.metaKey && !keyevent.ctrlKey && !keyevent.altKey && !keyevent.metaKey;
if (isCharacterKey) {
logger.info("Sending keyboardEvent for buffering ", keyevent)
logger.debug("Sending keyboardEvent for buffering ", keyevent)
Messaging.messageOwnTab("commandline_frame", "bufferUntilClInputFocused", [keyevent.key]);
}
keyevent.preventDefault()

View file

@ -3861,7 +3861,7 @@ export function sleep(time_ms: number) {
/** @hidden */
//#content
export function showcmdline(focus = true) {
logger.info("Called showcmdline")
logger.debug("Called showcmdline")
const hidehover = true
CommandLineContent.show(hidehover)
let done = Promise.resolve()

View file

@ -15,7 +15,7 @@ export type TabMessageType =
| "lock"
| "alive"
| "tab_changes"
| "clInputFocused"
| "cl_input_focused"
export type NonTabMessageType =
| "owntab_background"