remove redundant getRowHeight method

This commit is contained in:
nightwing 2012-07-29 15:04:40 +04:00
commit f976663150
4 changed files with 9 additions and 21 deletions

View file

@ -2029,7 +2029,7 @@ var EditSession = function(text, mode) {
* - row (Number): The row number to check
*
*
* Returns the length of the indicated row.
* Returns number of screenrows in a wrapped line.
**/
this.getRowLength = function(row) {
if (!this.$useWrapMode || !this.$wrapData[row]) {
@ -2039,18 +2039,6 @@ var EditSession = function(text, mode) {
}
};
/**
* EditSession.getRowHeight(config, row) -> Number
* - config (Object): An object containing a parameter indicating the `lineHeight`.
* - row (Number): The row number to check
*
* Returns the height of the indicated row. This is mostly relevant for situations where wrapping occurs, and a single line spans across multiple rows.
*
**/
this.getRowHeight = function(config, row) {
return this.getRowLength(row) * config.lineHeight;
};
/** internal, hide, related to: EditSession.documentToScreenColumn
* EditSession.getScreenLastRowColumn(screenRow) -> Number
* - screenRow (Number): The screen row to check

View file

@ -129,7 +129,7 @@ var Gutter = function(parentEl) {
breakpoints[i] ? " ace_breakpoint " : " ",
annotation.className,
"' title='", annotation.text.join("\n"),
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i));
if (foldWidgets) {
var c = foldWidgets[i];

View file

@ -115,10 +115,10 @@ MockRenderer.prototype.scrollToX = function(scrollTop) {};
MockRenderer.prototype.scrollToY = function(scrollLeft) {};
MockRenderer.prototype.scrollToLine = function(line, center) {
var lineHeight = { lineHeight: 16 };
var lineHeight = 16;
var row = 0;
for (var l = 1; l < line; l++) {
row += this.session.getRowHeight(lineHeight, l-1) / lineHeight.lineHeight;
row += this.session.getRowLength(l-1);
}
if (center) {

View file

@ -775,7 +775,7 @@ var VirtualRenderer = function(container, theme) {
// Map lines on the screen to lines in the document.
var firstRowScreen, firstRowHeight;
var lineHeight = { lineHeight: this.lineHeight };
var lineHeight = this.lineHeight;
firstRow = session.screenToDocumentRow(firstRow, 0);
// Check if firstRow is inside of a foldLine. If true, then use the first
@ -786,13 +786,13 @@ var VirtualRenderer = function(container, theme) {
}
firstRowScreen = session.documentToScreenRow(firstRow, 0);
firstRowHeight = session.getRowHeight(lineHeight, firstRow);
firstRowHeight = session.getRowLength(firstRow) * lineHeight;
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+
minHeight = this.$size.scrollerHeight + session.getRowLength(lastRow) * lineHeight +
firstRowHeight;
offset = this.scrollTop - firstRowScreen * this.lineHeight;
offset = this.scrollTop - firstRowScreen * lineHeight;
this.layerConfig = {
width : longestLine,
@ -800,7 +800,7 @@ var VirtualRenderer = function(container, theme) {
firstRow : firstRow,
firstRowScreen: firstRowScreen,
lastRow : lastRow,
lineHeight : this.lineHeight,
lineHeight : lineHeight,
characterWidth : this.characterWidth,
minHeight : minHeight,
maxHeight : maxHeight,