Fix rendering bugs. Make SVG session default for testing.

This commit is contained in:
Julian Viereck 2011-04-25 23:25:08 +02:00
commit 155115035c
4 changed files with 13 additions and 12 deletions

View file

@ -231,11 +231,11 @@ var Text = function(parentEl) {
var el = this.element;
if (oldConfig.firstRow < config.firstRow)
for (var row=oldConfig.firstRow; row<config.firstRow; row++)
for (var row=oldConfig.firstRow; row<config.firstRow; row = this.session.getRowFoldEnd(row) + 1)
el.removeChild(el.firstChild);
if (oldConfig.lastRow > config.lastRow)
for (var row=config.lastRow+1; row<=oldConfig.lastRow; row++)
for (var row=config.lastRow+1; row<=oldConfig.lastRow; row = this.session.getRowFoldEnd(row) + 1)
el.removeChild(el.lastChild);
if (config.firstRow < oldConfig.firstRow) {
@ -402,13 +402,6 @@ var Text = function(parentEl) {
}
this.$renderLine = function(stringBuilder, row, tokens) {
// Nothing to do if the entire line is folded.
// TODO: Remove this, once the folding feature is done. Only for
// developing stuff at the moment.
// if (!this.session.isRowVisible(row)) {
// throw "Calling renderLine on folded line doesn't make sense?";
// }
// Check if the line to render is folded or not. If not, things are
// simple, otherwise, we need to fake some things...
if (!this.session.isRowFolded(row)) {
@ -474,7 +467,9 @@ var Text = function(parentEl) {
if (isNewRow) {
tokens = this.tokenizer.getTokens(row, row)[0].tokens;
}
addTokens(tokens, lastColumn, column);
if (tokens.length != 0) {
addTokens(tokens, lastColumn, column);
}
}
}.bind(this), foldLine.end.row, this.session.getLine(foldLine.end.row).length);

View file

@ -478,7 +478,7 @@ var VirtualRenderer = function(container, theme) {
var firstRowScreen, firstRowHeight;
var lineHeight = { lineHeight: this.lineHeight };
firstRow = session.screenToDocumentRow(firstRow, 0);
firstRowScreen = session.documentToScreenRow(firstRow);
firstRowScreen = session.documentToScreenRow(firstRow, 0);
firstRowHeight = session.getRowHeight(lineHeight, firstRow);
lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
@ -500,6 +500,9 @@ var VirtualRenderer = function(container, theme) {
height : this.$size.scrollerHeight
};
// For debugging.
// console.log(JSON.stringify(layerConfig));
this.$gutterLayer.element.style.marginTop = (-offset) + "px";
this.content.style.marginTop = (-offset) + "px";
this.content.style.width = longestLine + "px";