fix scrollToLine for sessions containing folds

This commit is contained in:
nightwing 2012-01-02 18:21:11 +04:00
commit 35aecf42af
3 changed files with 9 additions and 13 deletions

View file

@ -93,7 +93,7 @@ var Cursor = function(parentEl) {
}, 1000);
};
this.getPixelPosition = function(onScreen) {
this.getPixelPosition = function(position, onScreen) {
if (!this.config || !this.session) {
return {
left : 0,
@ -101,7 +101,8 @@ var Cursor = function(parentEl) {
};
}
var position = this.session.selection.getCursor();
if (!position)
position = this.session.selection.getCursor();
var pos = this.session.documentToScreenPosition(position);
var cursorLeft = Math.round(this.$padding +
pos.column * this.config.characterWidth);
@ -117,7 +118,7 @@ var Cursor = function(parentEl) {
this.update = function(config) {
this.config = config;
this.pixelPos = this.getPixelPosition(true);
this.pixelPos = this.getPixelPosition(null, true);
this.cursor.style.left = this.pixelPos.left + "px";
this.cursor.style.top = this.pixelPos.top + "px";