From 3d9ea7a44bbd490be57d6b49358d7b1bb99dc259 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilev Date: Tue, 11 Jul 2023 21:51:46 +0300 Subject: [PATCH] Fix bug addLineWidget(widget) was called twice with the same widget, which caused inifite loop in ace editor --- src/editor/editor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editor/editor.js b/src/editor/editor.js index 14ba7ba..b2a0fc5 100644 --- a/src/editor/editor.js +++ b/src/editor/editor.js @@ -268,7 +268,7 @@ export class Editor { content.appendChild(el('span', 'eval_error', stringify_for_header(error))) } - this.widget = { + const widget = this.widget = { row, fixedWidth: true, el: container, @@ -276,8 +276,8 @@ export class Editor { } - const LineWidgets = require("ace/line_widgets").LineWidgets; if (!session.widgetManager) { + const LineWidgets = require("ace/line_widgets").LineWidgets; session.widgetManager = new LineWidgets(session); session.widgetManager.attach(this.ace_editor); } @@ -287,7 +287,7 @@ export class Editor { // which is async in ace_editor. Use setTimeout setTimeout(() => { this.update_value_explorer_margin() - session.widgetManager.addLineWidget(this.widget) + session.widgetManager.addLineWidget(widget) }, 0) }