Changing tabs no longer triggers a bake

This commit is contained in:
n1474335 2023-02-24 17:34:35 +00:00
parent 251bd86ce5
commit cdde7166cf
2 changed files with 7 additions and 3 deletions

View file

@ -138,8 +138,9 @@ class InputWaiter {
EditorView.updateListener.of(e => { EditorView.updateListener.of(e => {
if (e.selectionSet) if (e.selectionSet)
this.manager.highlighter.selectionChange("input", e); this.manager.highlighter.selectionChange("input", e);
if (e.docChanged) if (e.docChanged && !this.silentInputChange)
this.inputChange(e); this.inputChange(e);
this.silentInputChange = false;
}) })
] ]
}); });
@ -219,8 +220,9 @@ class InputWaiter {
/** /**
* Sets the value of the current input * Sets the value of the current input
* @param {string} data * @param {string} data
* @param {boolean} [silent=false]
*/ */
setInput(data) { setInput(data, silent=false) {
const lineLengthThreshold = 131072; // 128KB const lineLengthThreshold = 131072; // 128KB
let wrap = this.app.options.wordWrap; let wrap = this.app.options.wordWrap;
if (data.length > lineLengthThreshold) { if (data.length > lineLengthThreshold) {
@ -243,6 +245,7 @@ class InputWaiter {
// of the editor. This is mainly with the above call to setWordWrap() in mind. // of the editor. This is mainly with the above call to setWordWrap() in mind.
setTimeout(() => { setTimeout(() => {
// Insert data into editor, overwriting any previous contents // Insert data into editor, overwriting any previous contents
this.silentInputChange = silent;
this.inputEditorView.dispatch({ this.inputEditorView.dispatch({
changes: { changes: {
from: 0, from: 0,
@ -584,7 +587,7 @@ class InputWaiter {
this.manager.timing.recordTime("inputEncodingEnd", inputNum); this.manager.timing.recordTime("inputEncodingEnd", inputNum);
// Populate the input editor // Populate the input editor
this.setInput(inputVal); this.setInput(inputVal, silent);
// Set URL to current input // Set URL to current input
if (inputVal.length >= 0 && inputVal.length <= 51200) { if (inputVal.length >= 0 && inputVal.length <= 51200) {

View file

@ -966,6 +966,7 @@ class OutputWaiter {
*/ */
changeTabClick(mouseEvent) { changeTabClick(mouseEvent) {
if (!mouseEvent.target) return; if (!mouseEvent.target) return;
const tabNum = mouseEvent.target.parentElement.getAttribute("inputNum"); const tabNum = mouseEvent.target.parentElement.getAttribute("inputNum");
if (tabNum) { if (tabNum) {
this.changeTab(parseInt(tabNum, 10), this.app.options.syncTabs); this.changeTab(parseInt(tabNum, 10), this.app.options.syncTabs);