From f7bbfd6eadb5d54bfbef37938d8d4dd182e55a02 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 18 Feb 2022 22:29:02 +0300 Subject: [PATCH] fix mozdoc widget when duplicating section --- edit/moz-section-widget.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/edit/moz-section-widget.js b/edit/moz-section-widget.js index 84ffb0a2..41e668ed 100644 --- a/edit/moz-section-widget.js +++ b/edit/moz-section-widget.js @@ -276,13 +276,14 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) { let widget = old && old.widget; const height = Math.round(funcHeight * (sec.funcs.length || 1)) || undefined; const node = renderContainer(sec, widget); - if (widget) { + if (widget && widget.line.lineNo() === sec.start.line) { widget.node = node; if (height && height !== widget.height) { widget.height = height; widget.changed(); } } else { + if (widget) widget.clear(); widget = cm.addLineWidget(sec.start.line, node, { coverGutter: true, noHScroll: true,