Merge pull request #741 from ajaxorg/hotfix/prevent_unwanted_scrollintoview
a document change now doesn't scroll the cursor into view
This commit is contained in:
commit
e50c738d3e
1 changed files with 11 additions and 7 deletions
|
|
@ -282,6 +282,14 @@ var Editor = function(renderer, session) {
|
||||||
this._emit("blur");
|
this._emit("blur");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function cursorChange() {
|
||||||
|
this.renderer.updateCursor();
|
||||||
|
|
||||||
|
// move text input over the cursor
|
||||||
|
// this is required for iOS and IME
|
||||||
|
this.renderer.moveTextAreaToCursor(this.textInput.getElement());
|
||||||
|
}
|
||||||
|
|
||||||
this.onDocumentChange = function(e) {
|
this.onDocumentChange = function(e) {
|
||||||
var delta = e.data;
|
var delta = e.data;
|
||||||
var range = delta.range;
|
var range = delta.range;
|
||||||
|
|
@ -296,7 +304,7 @@ var Editor = function(renderer, session) {
|
||||||
this._emit("change", e);
|
this._emit("change", e);
|
||||||
|
|
||||||
// update cursor because tab characters can influence the cursor position
|
// update cursor because tab characters can influence the cursor position
|
||||||
this.onCursorChange();
|
cursorChange.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onTokenizerUpdate = function(e) {
|
this.onTokenizerUpdate = function(e) {
|
||||||
|
|
@ -313,16 +321,12 @@ var Editor = function(renderer, session) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onCursorChange = function() {
|
this.onCursorChange = function() {
|
||||||
this.renderer.updateCursor();
|
cursorChange.call(this);
|
||||||
|
|
||||||
if (!this.$blockScrolling) {
|
if (!this.$blockScrolling) {
|
||||||
this.renderer.scrollCursorIntoView();
|
this.renderer.scrollCursorIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
// move text input over the cursor
|
|
||||||
// this is required for iOS and IME
|
|
||||||
this.renderer.moveTextAreaToCursor(this.textInput.getElement());
|
|
||||||
|
|
||||||
this.$highlightBrackets();
|
this.$highlightBrackets();
|
||||||
this.$updateHighlightActiveLine();
|
this.$updateHighlightActiveLine();
|
||||||
};
|
};
|
||||||
|
|
@ -1239,7 +1243,7 @@ var Editor = function(renderer, session) {
|
||||||
var cursor = this.getCursorPosition();
|
var cursor = this.getCursorPosition();
|
||||||
if (!this.isRowFullyVisible(cursor.row))
|
if (!this.isRowFullyVisible(cursor.row))
|
||||||
this.scrollToLine(cursor.row, true);
|
this.scrollToLine(cursor.row, true);
|
||||||
|
|
||||||
//@todo scroll X
|
//@todo scroll X
|
||||||
//if (!this.isColumnFullyVisible(cursor.column))
|
//if (!this.isColumnFullyVisible(cursor.column))
|
||||||
//this.scrollToRow(cursor.column);
|
//this.scrollToRow(cursor.column);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue