fix #1239 on('changeScrollTop') argument is an object instead of number
This commit is contained in:
parent
c6ba1957aa
commit
2f55065e84
3 changed files with 34 additions and 33 deletions
|
|
@ -360,31 +360,32 @@ bindCheckbox("read_only", function(checked) {
|
||||||
env.editor.setReadOnly(checked);
|
env.editor.setReadOnly(checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
var secondSession = null;
|
|
||||||
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) {
|
|
||||||
secondSession = 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") {
|
sp.setOrientation(value == "below" ? sp.BELOW : sp.BESIDE);
|
||||||
sp.setOrientation(sp.BELOW);
|
|
||||||
} else {
|
|
||||||
sp.setOrientation(sp.BESIDE);
|
|
||||||
}
|
|
||||||
sp.setSplits(2);
|
sp.setSplits(2);
|
||||||
|
|
||||||
if (newEditor) {
|
if (newEditor) {
|
||||||
var session = secondSession || sp.getEditor(0).session;
|
var session = sp.getEditor(0).session;
|
||||||
var newSession = sp.setSession(session, 1);
|
var newSession = sp.setSession(session, 1);
|
||||||
newSession.name = session.name;
|
newSession.name = session.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function synchroniseScrolling() {
|
||||||
|
var s1 = env.split.$editors[0].session;
|
||||||
|
var s2 = env.split.$editors[1].session;
|
||||||
|
s1.on('changeScrollTop', function(pos) {s2.setScrollTop(pos)});
|
||||||
|
s2.on('changeScrollTop', function(pos) {s1.setScrollTop(pos)});
|
||||||
|
s1.on('changeScrollLeft', function(pos) {s2.setScrollLeft(pos)});
|
||||||
|
s2.on('changeScrollLeft', function(pos) {s1.setScrollLeft(pos)});
|
||||||
|
}
|
||||||
|
|
||||||
bindCheckbox("highlight_token", function(checked) {
|
bindCheckbox("highlight_token", function(checked) {
|
||||||
var editor = env.editor;
|
var editor = env.editor;
|
||||||
if (editor.tokenTooltip && !checked) {
|
if (editor.tokenTooltip && !checked) {
|
||||||
|
|
|
||||||
|
|
@ -997,11 +997,11 @@ var EditSession = function(text, mode) {
|
||||||
**/
|
**/
|
||||||
this.setScrollTop = function(scrollTop) {
|
this.setScrollTop = function(scrollTop) {
|
||||||
scrollTop = Math.round(Math.max(0, scrollTop));
|
scrollTop = Math.round(Math.max(0, scrollTop));
|
||||||
if (this.$scrollTop === scrollTop)
|
if (this.$scrollTop === scrollTop || isNaN(scrollTop))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.$scrollTop = scrollTop;
|
this.$scrollTop = scrollTop;
|
||||||
this._emit("changeScrollTop", scrollTop);
|
this._signal("changeScrollTop", scrollTop);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1018,11 +1018,11 @@ var EditSession = function(text, mode) {
|
||||||
**/
|
**/
|
||||||
this.setScrollLeft = function(scrollLeft) {
|
this.setScrollLeft = function(scrollLeft) {
|
||||||
scrollLeft = Math.round(Math.max(0, scrollLeft));
|
scrollLeft = Math.round(Math.max(0, scrollLeft));
|
||||||
if (this.$scrollLeft === scrollLeft)
|
if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.$scrollLeft = scrollLeft;
|
this.$scrollLeft = scrollLeft;
|
||||||
this._emit("changeScrollLeft", scrollLeft);
|
this._signal("changeScrollLeft", scrollLeft);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ var Editor = require("./editor").Editor;
|
||||||
if (this.$readOnly)
|
if (this.$readOnly)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._emit("paste", text);
|
this._signal("paste", text);
|
||||||
if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
|
if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
|
||||||
return this.insert(text);
|
return this.insert(text);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue