diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index 84d82520..47bd1b42 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -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; } diff --git a/lib/ace/theme/textmate.js b/lib/ace/theme/textmate.js index 33c8aa25..5011b636 100644 --- a/lib/ace/theme/textmate.js +++ b/lib/ace/theme/textmate.js @@ -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 {\ diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 925e7b4a..b5fc4289 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -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() {