Merge remote-tracking branch 'nightwing/pullreq'

Conflicts:
	lib/ace/virtual_renderer.js
This commit is contained in:
Fabian Jakobs 2012-02-02 11:25:34 +01:00
commit dd55f74256
3 changed files with 31 additions and 27 deletions

View file

@ -22,12 +22,6 @@
cursor: text;
}
/* setting pointer-events: auto; on node under the mouse, which changes during scroll,
will break mouse wheel scrolling in Safari */
.ace_content * {
pointer-events: none;
}
.ace_composition {
position: absolute;
background: #555;
@ -35,12 +29,6 @@
z-index: 4;
}
.ace_gutter .ace_layer {
position: relative;
min-width: 54px;
text-align: right;
}
.ace_gutter {
position: absolute;
overflow : hidden;
@ -125,6 +113,16 @@
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none;
}
.ace_gutter .ace_layer {
position: relative;
min-width: 40px;
text-align: right;
pointer-events: auto;
}
.ace_text-layer {
@ -222,7 +220,7 @@
cursor: move;
}
.ace_folding-enabled .ace_gutter-cell {
.ace_folding-enabled > .ace_gutter-cell {
padding-right: 13px;
}

View file

@ -59,7 +59,7 @@ exports.cssText = ".ace-tm .ace_editor {\
}\
\
.ace-tm .ace_fold {\
background-color: #0000A2;\
background-color: #6B72E6;\
}\
\
.ace-tm .ace_text-layer {\

View file

@ -421,21 +421,27 @@ var VirtualRenderer = function(container, theme) {
)
this.$computeLayerConfig();
// horizontal scrolling
if (changes & this.CHANGE_H_SCROLL)
this.scroller.scrollLeft = this.scrollLeft
// full
if (changes & this.CHANGE_FULL) {
this.$textLayer.checkForSizeChanges();
// update scrollbar first to not loose scroll position when gutter calls resize
this.$updateScrollBar();
this.$textLayer.update(this.layerConfig);
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
this.$markerBack.update(this.layerConfig);
this.$markerFront.update(this.layerConfig);
this.$cursorLayer.update(this.layerConfig);
this.$updateScrollBar();
return;
}
// scrolling
if (changes & this.CHANGE_SCROLL) {
this.$updateScrollBar();
if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
this.$textLayer.update(this.layerConfig);
else
@ -446,7 +452,6 @@ var VirtualRenderer = function(container, theme) {
this.$markerBack.update(this.layerConfig);
this.$markerFront.update(this.layerConfig);
this.$cursorLayer.update(this.layerConfig);
this.$updateScrollBar();
return;
}
@ -456,10 +461,11 @@ var VirtualRenderer = function(container, theme) {
this.$gutterLayer.update(this.layerConfig);
}
else if (changes & this.CHANGE_LINES) {
this.$updateLines();
this.$updateScrollBar();
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
if (this.$updateLines()) {
this.$updateScrollBar();
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
}
} else if (changes & this.CHANGE_GUTTER) {
if (this.showGutter)
this.$gutterLayer.update(this.layerConfig);
@ -478,11 +484,6 @@ var VirtualRenderer = function(container, theme) {
if (changes & this.CHANGE_SIZE)
this.$updateScrollBar();
if (changes & this.CHANGE_H_SCROLL) {
//this.content.style.left = -this.scrollLeft + "px";
this.scroller.scrollLeft = this.scrollLeft
}
};
this.$computeLayerConfig = function() {
@ -496,9 +497,13 @@ var VirtualRenderer = function(container, theme) {
var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
var horizScrollChanged = this.$horizScroll !== horizScroll;
this.$horizScroll = horizScroll;
if (horizScrollChanged)
if (horizScrollChanged) {
this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
// when we hide scrollbar scroll event isn't emited
// leaving session with wrong scrollLeft value
if (!horizScroll)
this.session.setScrollLeft(0);
}
var maxHeight = this.session.getScreenLength() * this.lineHeight;
this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));
@ -579,6 +584,7 @@ var VirtualRenderer = function(container, theme) {
// else update only the changed rows
this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
return true;
};
this.$getLongestLine = function() {