Fixed failing unit test by implementing MockRenderer#scrollToLine

This commit is contained in:
James Allen 2011-02-14 20:02:02 +08:00 committed by cloud9Deploy
commit d7539ff362

View file

@ -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() {