Fix: use Math.max

This commit is contained in:
eight 2017-11-09 06:16:07 +08:00
parent a7b73e859f
commit caaeec08e4

View File

@ -107,10 +107,7 @@ function createAppliesToLineWidget(cm) {
const toIndex = widgets[j] ? cm.indexFromPos({line: widgets[j].line.lineNo(), ch: 0}) : cm.getValue().length; const toIndex = widgets[j] ? cm.indexFromPos({line: widgets[j].line.lineNo(), ch: 0}) : cm.getValue().length;
// splice // splice
if (i < 0) { i = Math.max(0, i);
i = 0;
}
widgets.splice(i, 0, ...createWidgets(fromIndex, toIndex, widgets.splice(i, j - i))); widgets.splice(i, 0, ...createWidgets(fromIndex, toIndex, widgets.splice(i, j - i)));
fromLine = null; fromLine = null;