Fix render misalignment. Looks good so far.

This commit is contained in:
Julian Viereck 2011-04-28 14:06:03 +02:00
commit 1d9dbe6d3e
2 changed files with 10 additions and 2 deletions

View file

@ -157,7 +157,7 @@ exports.launch = function(env) {
docs.svg.addFold(new Range(1, 0, 7, 0), "fold...");
docs.plain.addFold(new Range(0, 90, 2, 30), "fold");
window.s = docs.js;
window.s = docs.plain;
window.e = env.editor;
setTimeout(function() {
env.editor.selection.addEventListener("changeCursor", function() {

View file

@ -478,6 +478,14 @@ var VirtualRenderer = function(container, theme) {
var firstRowScreen, firstRowHeight;
var lineHeight = { lineHeight: this.lineHeight };
firstRow = session.screenToDocumentRow(firstRow, 0);
// Check if firstRow is inside of a foldLine. If true, then use the first
// row of the foldLine.
var foldLine = session.getFoldLine(firstRow);
if (foldLine) {
firstRow = foldLine.start.row;
}
firstRowScreen = session.documentToScreenRow(firstRow, 0);
firstRowHeight = session.getRowHeight(lineHeight, firstRow);
@ -501,7 +509,7 @@ var VirtualRenderer = function(container, theme) {
};
// For debugging.
console.log(JSON.stringify(layerConfig));
// console.log(JSON.stringify(layerConfig));
this.$gutterLayer.element.style.marginTop = (-offset) + "px";
this.content.style.marginTop = (-offset) + "px";