fix mozdoc widget when duplicating section

This commit is contained in:
tophf 2022-02-18 22:29:02 +03:00
parent dff0c133b4
commit f7bbfd6ead

View File

@ -276,13 +276,14 @@ function MozSectionWidget(cm, finder = MozSectionFinder(cm)) {
let widget = old && old.widget; let widget = old && old.widget;
const height = Math.round(funcHeight * (sec.funcs.length || 1)) || undefined; const height = Math.round(funcHeight * (sec.funcs.length || 1)) || undefined;
const node = renderContainer(sec, widget); const node = renderContainer(sec, widget);
if (widget) { if (widget && widget.line.lineNo() === sec.start.line) {
widget.node = node; widget.node = node;
if (height && height !== widget.height) { if (height && height !== widget.height) {
widget.height = height; widget.height = height;
widget.changed(); widget.changed();
} }
} else { } else {
if (widget) widget.clear();
widget = cm.addLineWidget(sec.start.line, node, { widget = cm.addLineWidget(sec.start.line, node, {
coverGutter: true, coverGutter: true,
noHScroll: true, noHScroll: true,