Merge master

This commit is contained in:
Garen Torikian 2012-04-10 10:39:55 -07:00
commit fc4625e1b6
335 changed files with 25316 additions and 11663 deletions

View file

@ -103,6 +103,8 @@ var VirtualRenderer = function(container, theme) {
this.$horizScroll = true;
this.$horizScrollAlwaysVisible = true;
this.$animatedScroll = false;
this.scrollBar = new ScrollBar(container);
this.scrollBar.addEventListener("scroll", function(e) {
_self.session.setScrollTop(e.data);
@ -274,6 +276,14 @@ var VirtualRenderer = function(container, theme) {
return this.session.adjustWrapLimit(limit);
};
this.setAnimatedScroll = function(shouldAnimate){
this.$animatedScroll = shouldAnimate;
}
this.getAnimatedscroll = function(){
return this.$animatedScroll
}
this.setShowInvisibles = function(showInvisibles) {
if (this.$textLayer.setShowInvisibles(showInvisibles))
this.$loop.schedule(this.CHANGE_TEXT);
@ -647,12 +657,18 @@ var VirtualRenderer = function(container, theme) {
this.$cursorLayer.showCursor();
};
this.scrollCursorIntoView = function() {
this.scrollSelectionIntoView = function(anchor, lead) {
// first scroll anchor into view then scroll lead into view
this.scrollCursorIntoView(anchor);
this.scrollCursorIntoView(lead);
};
this.scrollCursorIntoView = function(cursor) {
// the editor is not visible
if (this.$size.scrollerHeight === 0)
return;
var pos = this.$cursorLayer.getPixelPosition();
var pos = this.$cursorLayer.getPixelPosition(cursor);
var left = pos.left;
var top = pos.top;
@ -698,7 +714,7 @@ var VirtualRenderer = function(container, theme) {
this.session.setScrollTop(row * this.lineHeight);
};
var STEPS = 15;
var STEPS = 10;
function calcSteps(fromValue, toValue){
var i = 0,
l = STEPS,
@ -722,8 +738,9 @@ var VirtualRenderer = function(container, theme) {
if (center)
offset -= this.$size.scrollerHeight / 2;
if (this.$animatedScroll && Math.abs(offset - this.scrollTop) < 10000) {
var i = 0, _self = this,
steps = calcSteps(this.scrollTop, offset);// console.dir(steps);
steps = calcSteps(this.scrollTop, offset);
clearInterval(_self.$timer);
this.$timer = setInterval(function(){
_self.session.setScrollTop(steps[i]);
@ -731,6 +748,10 @@ var VirtualRenderer = function(container, theme) {
if (++i == STEPS + 1)
clearInterval(_self.$timer);
}, 10);
}
else {
this.session.setScrollTop(offset);
}
};
this.scrollToY = function(scrollTop) {