From cdde7166cff4c30360642b037a5b24857251b501 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 24 Feb 2023 17:34:35 +0000 Subject: [PATCH] Changing tabs no longer triggers a bake --- src/web/waiters/InputWaiter.mjs | 9 ++++++--- src/web/waiters/OutputWaiter.mjs | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/web/waiters/InputWaiter.mjs b/src/web/waiters/InputWaiter.mjs index 12796803..fc4544ba 100644 --- a/src/web/waiters/InputWaiter.mjs +++ b/src/web/waiters/InputWaiter.mjs @@ -138,8 +138,9 @@ class InputWaiter { EditorView.updateListener.of(e => { if (e.selectionSet) this.manager.highlighter.selectionChange("input", e); - if (e.docChanged) + if (e.docChanged && !this.silentInputChange) this.inputChange(e); + this.silentInputChange = false; }) ] }); @@ -219,8 +220,9 @@ class InputWaiter { /** * Sets the value of the current input * @param {string} data + * @param {boolean} [silent=false] */ - setInput(data) { + setInput(data, silent=false) { const lineLengthThreshold = 131072; // 128KB let wrap = this.app.options.wordWrap; if (data.length > lineLengthThreshold) { @@ -243,6 +245,7 @@ class InputWaiter { // of the editor. This is mainly with the above call to setWordWrap() in mind. setTimeout(() => { // Insert data into editor, overwriting any previous contents + this.silentInputChange = silent; this.inputEditorView.dispatch({ changes: { from: 0, @@ -584,7 +587,7 @@ class InputWaiter { this.manager.timing.recordTime("inputEncodingEnd", inputNum); // Populate the input editor - this.setInput(inputVal); + this.setInput(inputVal, silent); // Set URL to current input if (inputVal.length >= 0 && inputVal.length <= 51200) { diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs index 68552a79..131e0987 100755 --- a/src/web/waiters/OutputWaiter.mjs +++ b/src/web/waiters/OutputWaiter.mjs @@ -966,6 +966,7 @@ class OutputWaiter { */ changeTabClick(mouseEvent) { if (!mouseEvent.target) return; + const tabNum = mouseEvent.target.parentElement.getAttribute("inputNum"); if (tabNum) { this.changeTab(parseInt(tabNum, 10), this.app.options.syncTabs);