Merge branch 'master' into doc/api
This commit is contained in:
commit
870fe2c74e
47 changed files with 420 additions and 341 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ var Text = function(parentEl) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// Size and width can be null if the editor is not visible or
|
||||
// detached from the document
|
||||
if (!this.element.offsetWidth)
|
||||
return null;
|
||||
|
||||
var style = this.$measureNode.style;
|
||||
var computedStyle = dom.computedStyle(this.element);
|
||||
|
|
|
|||
|
|
@ -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 {\
|
||||
|
|
|
|||
|
|
@ -126,7 +126,9 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.scrollLeft = 0;
|
||||
|
||||
event.addListener(this.scroller, "scroll", function() {
|
||||
_self.session.setScrollLeft(_self.scroller.scrollLeft);
|
||||
var scrollLeft = _self.scroller.scrollLeft;
|
||||
_self.scrollLeft = scrollLeft;
|
||||
_self.session.setScrollLeft(scrollLeft);
|
||||
});
|
||||
|
||||
this.cursorPos = {
|
||||
|
|
@ -560,7 +562,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.$renderChanges = function(changes) {
|
||||
if (!changes || !this.session)
|
||||
if (!changes || !this.session || !this.container.offsetWidth)
|
||||
return;
|
||||
|
||||
// text, scrolling and resize changes can cause the view port size to change
|
||||
|
|
@ -572,20 +574,33 @@ var VirtualRenderer = function(container, theme) {
|
|||
)
|
||||
this.$computeLayerConfig();
|
||||
|
||||
// horizontal scrolling
|
||||
if (changes & this.CHANGE_H_SCROLL) {
|
||||
this.scroller.scrollLeft = this.scrollLeft;
|
||||
|
||||
// read the value after writing it since the value might get clipped
|
||||
var scrollLeft = this.scroller.scrollLeft;
|
||||
this.scrollLeft = scrollLeft;
|
||||
this.session.setScrollLeft(scrollLeft);
|
||||
}
|
||||
|
||||
// full
|
||||
if (changes & this.CHANGE_FULL) {
|
||||
this.$textLayer.checkForSizeChanges();
|
||||
// update scrollbar first to not lose 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
|
||||
|
|
@ -596,7 +611,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$markerBack.update(this.layerConfig);
|
||||
this.$markerFront.update(this.layerConfig);
|
||||
this.$cursorLayer.update(this.layerConfig);
|
||||
this.$updateScrollBar();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -606,10 +620,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);
|
||||
|
|
@ -628,11 +643,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() {
|
||||
|
|
@ -646,9 +656,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)));
|
||||
|
||||
|
|
@ -729,6 +743,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
// else update only the changed rows
|
||||
this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
|
||||
return true;
|
||||
};
|
||||
|
||||
this.$getLongestLine = function() {
|
||||
|
|
@ -883,7 +898,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
* (~EditSession.getScrollLeft)
|
||||
**/
|
||||
this.getScrollLeft = function() {
|
||||
return this.session.getScrollTop();
|
||||
return this.session.getScrollLeft();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -958,10 +973,9 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (scrollLeft <= this.$padding)
|
||||
scrollLeft = 0;
|
||||
|
||||
if (this.scrollLeft !== scrollLeft) {
|
||||
this.$loop.schedule(this.CHANGE_H_SCROLL);
|
||||
if (this.scrollLeft !== scrollLeft)
|
||||
this.scrollLeft = scrollLeft;
|
||||
}
|
||||
this.$loop.schedule(this.CHANGE_H_SCROLL);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue