Reuse former session of second split. Add destroy function that stops some timeouts.
This commit is contained in:
parent
55328f3690
commit
87003ac4ed
6 changed files with 25 additions and 5 deletions
|
|
@ -369,7 +369,10 @@ exports.launch = function(env) {
|
||||||
bindDropdown("split", function(value) {
|
bindDropdown("split", function(value) {
|
||||||
var sp = env.split;
|
var sp = env.split;
|
||||||
if (value == "none") {
|
if (value == "none") {
|
||||||
|
if (sp.getSplits() == 2) {
|
||||||
|
secondSplitSession = sp.getEditor(1).session;
|
||||||
sp.setSplits(1);
|
sp.setSplits(1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var newEditor = (sp.getSplits() == 1);
|
var newEditor = (sp.getSplits() == 1);
|
||||||
if (value == "below") {
|
if (value == "below") {
|
||||||
|
|
@ -383,7 +386,6 @@ exports.launch = function(env) {
|
||||||
var session = secondSplitSession || sp.getEditor(0).session;
|
var session = secondSplitSession || sp.getEditor(0).session;
|
||||||
var newSession = sp.setSession(session, 1);
|
var newSession = sp.setSession(session, 1);
|
||||||
newSession.name = session.name;
|
newSession.name = session.name;
|
||||||
secondSplitSession = newSession;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1123,6 +1123,10 @@ var Editor =function(renderer, session) {
|
||||||
this.session.getUndoManager().redo();
|
this.session.getUndoManager().redo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.destroy = function() {
|
||||||
|
this.renderer.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
}).call(Editor.prototype);
|
}).call(Editor.prototype);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,10 @@ var Cursor = function(parentEl) {
|
||||||
this.restartTimer();
|
this.restartTimer();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.destroy = function() {
|
||||||
|
clearInterval(this.blinkId);
|
||||||
|
}
|
||||||
|
|
||||||
}).call(Cursor.prototype);
|
}).call(Cursor.prototype);
|
||||||
|
|
||||||
exports.Cursor = Cursor;
|
exports.Cursor = Cursor;
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ var Text = function(parentEl) {
|
||||||
|
|
||||||
this.$pollSizeChanges = function() {
|
this.$pollSizeChanges = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
setInterval(function() {
|
this.$pollSizeChangesTimer = setInterval(function() {
|
||||||
self.checkForSizeChanges();
|
self.checkForSizeChanges();
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
@ -517,6 +517,10 @@ var Text = function(parentEl) {
|
||||||
this.$renderLineCore(stringBuilder, row, renderTokens, splits);
|
this.$renderLineCore(stringBuilder, row, renderTokens, splits);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.destroy = function() {
|
||||||
|
clearInterval(this.$pollSizeChangesTimer);
|
||||||
|
};
|
||||||
|
|
||||||
}).call(Text.prototype);
|
}).call(Text.prototype);
|
||||||
|
|
||||||
exports.Text = Text;
|
exports.Text = Text;
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,7 @@ var Split = function(container, theme, splits) {
|
||||||
} else {
|
} else {
|
||||||
while (this.$splits > splits) {
|
while (this.$splits > splits) {
|
||||||
editor = this.$editors[this.$splits - 1];
|
editor = this.$editors[this.$splits - 1];
|
||||||
|
editor.destroy();
|
||||||
this.$container.removeChild(editor.container);
|
this.$container.removeChild(editor.container);
|
||||||
this.$editors.pop();
|
this.$editors.pop();
|
||||||
this.$splits --;
|
this.$splits --;
|
||||||
|
|
|
||||||
|
|
@ -794,6 +794,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
dom.removeCssClass(this.container, style)
|
dom.removeCssClass(this.container, style)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.destroy = function() {
|
||||||
|
this.$textLayer.destroy();
|
||||||
|
this.$cursorLayer.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
}).call(VirtualRenderer.prototype);
|
}).call(VirtualRenderer.prototype);
|
||||||
|
|
||||||
exports.VirtualRenderer = VirtualRenderer;
|
exports.VirtualRenderer = VirtualRenderer;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue