diff --git a/lib/ace/editor.js b/lib/ace/editor.js index ff781507..5ce8135a 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -170,12 +170,33 @@ var Editor = function(renderer, session) { command: commadEvent.command || {}, args: commadEvent.args }; + + var command = this.curOp.command; + if (command && command.scrollIntoView) + this.$blockScrolling++; this.selections.push(this.selection.toJSON()); }; this.endOperation = function() { if (this.curOp) { + var command = this.curOp.command; + if (command && command.scrollIntoView) { + this.$blockScrolling--; + switch (command.scrollIntoView) { + case "center": + this.renderer.scrollCursorIntoView(null, 0.5); + break; + case "cursor": + this.renderer.scrollCursorIntoView(); + break; + case "selectionPart": + this.renderer.scrollCursorIntoView(); + break; + default: + break; + } + } this.prevOp = this.curOp; this.curOp = null; }