Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addInputToHistory(input) {
var hist = this.inputHistory,
items = hist.items;
if (arr.last(items) === input) return;
items.push(input);
if (items.length > hist.max) {
hist.items = items = items.slice(-hist.max);
}
hist.index = items.length - 1;
if (!this.allowDuplicatesInHistory) {
for (var i = hist.items.length-1; i--; )
if (hist.items[i] === input) {
hist.items.splice(i, 1); hist.index--; }
}
this.historyId && this.constructor.addHistoryToLocalStorage(this.historyId, hist);
}
close() {
var world = this.world();
this.deactivate();
this.remove();
var next = world.activeWindow() || arr.last(world.getWindows());
next && next.activate();
signal(this, "windowClosed", this);
if (this.targetMorph && typeof this.targetMorph.onWindowClose === "function")
this.targetMorph.onWindowClose();
}
isActive() {
var w = this.world();
if (!w) return false;
if (this.titleLabel().fontWeight != "bold") return false;
return arr.last(w.getWindows()) === this;
}
_backwardUpSexp(ed, fromIndex) {
let ast = ed.editorPlugin.parse(),
node = arr.last(nodesAt(fromIndex, ast).slice(0, -1));
return (node && node.__location.startOffset) || fromIndex;
}