diff --git a/lib/ace/test/mockrenderer.js b/lib/ace/test/mockrenderer.js index 8d931483..9eb2b5c1 100644 --- a/lib/ace/test/mockrenderer.js +++ b/lib/ace/test/mockrenderer.js @@ -94,7 +94,17 @@ MockRenderer.prototype.updateCursor = function(position) { this.cursor.column = position.column; }; -MockRenderer.prototype.scrollToLine = function(row) { +MockRenderer.prototype.scrollToLine = function(line, center) { + var lineHeight = { lineHeight: 16 }; + var row = 0; + for (var l = 1; l < line; l++) { + row += this.session.getRowHeight(lineHeight, l-1) / lineHeight.lineHeight; + } + + if (center) { + row -= this.visibleRowCount / 2; + } + this.scrollToRow(row); }; MockRenderer.prototype.scrollCursorIntoView = function() {