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

@ -152,6 +152,8 @@ exports.launch = function(env) {
docs.js.addFold(new Range(0, 13, 0, 18), "args...");
docs.js.addFold(new Range(2, 20, 2, 25), "bar...");
docs.js.addFold(new Range(1, 10, 2, 10), "foo...");
docs.svg.addFold(new Range(1, 0, 7, 0), "fold...");
window.s = docs.js;
window.e = env.editor;
setTimeout(function() {

View file

@ -14,6 +14,7 @@
<td align="right">
<label for="doc">Document:</label>
<select id="doc" size="1">
<option value="svg">SVG Document</option>
<option value="js">JavaScript Document</option>
<option value="html">HTML Document</option>
<option value="css">CSS Document</option>
@ -25,7 +26,7 @@
<option value="java">Java Document</option>
<option value="csharp">C# Document</option>
<option value="c_cpp">C++ Document</option>
<option value="svg">SVG Document</option>
<option value="textile">Textile Document</option>
<option value="plain">Text Document</option>
</select>

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";