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) {
|
||||
var sp = env.split;
|
||||
if (value == "none") {
|
||||
sp.setSplits(1);
|
||||
if (sp.getSplits() == 2) {
|
||||
secondSplitSession = sp.getEditor(1).session;
|
||||
sp.setSplits(1);
|
||||
}
|
||||
} else {
|
||||
var newEditor = (sp.getSplits() == 1);
|
||||
if (value == "below") {
|
||||
|
|
@ -383,7 +386,6 @@ exports.launch = function(env) {
|
|||
var session = secondSplitSession || sp.getEditor(0).session;
|
||||
var newSession = sp.setSession(session, 1);
|
||||
newSession.name = session.name;
|
||||
secondSplitSession = newSession;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1123,6 +1123,10 @@ var Editor =function(renderer, session) {
|
|||
this.session.getUndoManager().redo();
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
this.renderer.destroy();
|
||||
}
|
||||
|
||||
}).call(Editor.prototype);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -123,16 +123,20 @@ var Cursor = function(parentEl) {
|
|||
if (this.isVisible) {
|
||||
this.element.appendChild(this.cursor);
|
||||
}
|
||||
|
||||
|
||||
if (this.session.getOverwrite()) {
|
||||
dom.addCssClass(this.cursor, "ace_overwrite");
|
||||
} else {
|
||||
dom.removeCssClass(this.cursor, "ace_overwrite");
|
||||
}
|
||||
|
||||
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
clearInterval(this.blinkId);
|
||||
}
|
||||
|
||||
}).call(Cursor.prototype);
|
||||
|
||||
exports.Cursor = Cursor;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ var Text = function(parentEl) {
|
|||
|
||||
this.$pollSizeChanges = function() {
|
||||
var self = this;
|
||||
setInterval(function() {
|
||||
this.$pollSizeChangesTimer = setInterval(function() {
|
||||
self.checkForSizeChanges();
|
||||
}, 500);
|
||||
};
|
||||
|
|
@ -517,6 +517,10 @@ var Text = function(parentEl) {
|
|||
this.$renderLineCore(stringBuilder, row, renderTokens, splits);
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
clearInterval(this.$pollSizeChangesTimer);
|
||||
};
|
||||
|
||||
}).call(Text.prototype);
|
||||
|
||||
exports.Text = Text;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ var Split = function(container, theme, splits) {
|
|||
} else {
|
||||
while (this.$splits > splits) {
|
||||
editor = this.$editors[this.$splits - 1];
|
||||
editor.destroy();
|
||||
this.$container.removeChild(editor.container);
|
||||
this.$editors.pop();
|
||||
this.$splits --;
|
||||
|
|
|
|||
|
|
@ -794,6 +794,11 @@ var VirtualRenderer = function(container, theme) {
|
|||
dom.removeCssClass(this.container, style)
|
||||
};
|
||||
|
||||
this.destroy = function() {
|
||||
this.$textLayer.destroy();
|
||||
this.$cursorLayer.destroy();
|
||||
}
|
||||
|
||||
}).call(VirtualRenderer.prototype);
|
||||
|
||||
exports.VirtualRenderer = VirtualRenderer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue