Reuse the editor instance in Split. Don't like that, but as the Editor is not destroyed completly, this is the base thing to do at the moment in case of memoery usage

This commit is contained in:
Julian Viereck 2011-05-20 23:37:27 +02:00
commit 4f06e21070
2 changed files with 7 additions and 8 deletions

View file

@ -365,14 +365,10 @@ exports.launch = function(env) {
env.editor.getSession().setUseSoftTabs(checked);
});
var secondSplitSession = null;
bindDropdown("split", function(value) {
var sp = env.split;
if (value == "none") {
if (sp.getSplits() == 2) {
secondSplitSession = sp.getEditor(1).session;
sp.setSplits(1);
}
sp.setSplits(1);
} else {
var newEditor = (sp.getSplits() == 1);
if (value == "below") {
@ -383,7 +379,7 @@ exports.launch = function(env) {
sp.setSplits(2);
if (newEditor) {
var session = secondSplitSession || sp.getEditor(0).session;
var session = sp.getEditor(0).session;
var newSession = sp.setSession(session, 1);
newSession.name = session.name;
}

View file

@ -96,6 +96,11 @@ var Split = function(container, theme, splits) {
if (splits == this.$splits) {
return;
} else if (splits > this.$splits) {
while (this.$splits < this.$editors.length && this.$splits < splits) {
var editor = this.$editors[this.$splits];
this.$container.appendChild(editor.container);
this.$splits ++;
}
while (this.$splits < splits) {
this.$createEditor();
this.$splits ++;
@ -103,9 +108,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 --;
}
}