diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 171886ab..01256ee3 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -507,8 +507,8 @@ var Editor =function(renderer, session) { if (shouldOutdent) { mode.autoOutdent(lineState, session, cursor.row); } - }; - } + } + }; this.onTextInput = function(text) { this.keyBinding.onTextInput(text); diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 729e9af5..9d7ce7f8 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -278,7 +278,7 @@ var VirtualRenderer = function(container, theme) { this.getShowGutter = function(){ return this.showGutter; - } + }; this.setShowGutter = function(show){ if(this.showGutter === show) @@ -286,10 +286,10 @@ var VirtualRenderer = function(container, theme) { this.$gutter.style.display = show ? "block" : "none"; this.showGutter = show; this.onResize(true); - } + }; this.$updatePrintMargin = function() { - var containerEl + var containerEl; if (!this.$showPrintMargin && !this.$printMarginEl) return; @@ -297,7 +297,7 @@ var VirtualRenderer = function(container, theme) { if (!this.$printMarginEl) { containerEl = dom.createElement("div"); containerEl.className = "ace_print_margin_layer"; - this.$printMarginEl = dom.createElement("div") + this.$printMarginEl = dom.createElement("div"); this.$printMarginEl.className = "ace_print_margin"; containerEl.appendChild(this.$printMarginEl); this.content.insertBefore(containerEl, this.$textLayer.element); @@ -344,8 +344,8 @@ var VirtualRenderer = function(container, theme) { if (!this.layerConfig) return 0; - return this.layerConfig.firstRow + (this.layerConfig.offset == 0 ? 0 : 1); - } + return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1); + }; this.getLastFullyVisibleRow = function() { if (!this.layerConfig) @@ -353,7 +353,7 @@ var VirtualRenderer = function(container, theme) { var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight); return this.layerConfig.firstRow - 1 + flint; - } + }; this.getLastVisibleRow = function() { return (this.layerConfig || {}).lastRow || 0; @@ -369,7 +369,7 @@ var VirtualRenderer = function(container, theme) { this.getHScrollBarAlwaysVisible = function() { return this.$horizScrollAlwaysVisible; - } + }; this.setHScrollBarAlwaysVisible = function(alwaysVisible) { if (this.$horizScrollAlwaysVisible != alwaysVisible) { @@ -377,7 +377,7 @@ var VirtualRenderer = function(container, theme) { if (!this.$horizScrollAlwaysVisible || !this.$horizScroll) this.$loop.schedule(this.CHANGE_SCROLL); } - } + }; this.onScroll = function(e) { this.scrollToY(e.data); @@ -405,7 +405,8 @@ var VirtualRenderer = function(container, theme) { // full if (changes & this.CHANGE_FULL) { this.$textLayer.update(this.layerConfig); - this.showGutter && this.$gutterLayer.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); @@ -419,7 +420,9 @@ var VirtualRenderer = function(container, theme) { this.$textLayer.update(this.layerConfig); else this.$textLayer.scrollLines(this.layerConfig); - this.showGutter && this.$gutterLayer.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); @@ -429,14 +432,17 @@ var VirtualRenderer = function(container, theme) { if (changes & this.CHANGE_TEXT) { this.$textLayer.update(this.layerConfig); - this.showGutter && this.$gutterLayer.update(this.layerConfig); + if (this.showGutter) + this.$gutterLayer.update(this.layerConfig); } else if (changes & this.CHANGE_LINES) { this.$updateLines(); this.$updateScrollBar(); - this.showGutter && this.$gutterLayer.update(this.layerConfig); + if (this.showGutter) + this.$gutterLayer.update(this.layerConfig); } else if (changes & this.CHANGE_GUTTER) { - this.showGutter && this.$gutterLayer.update(this.layerConfig); + if (this.showGutter) + this.$gutterLayer.update(this.layerConfig); } if (changes & this.CHANGE_CURSOR) @@ -547,7 +553,8 @@ var VirtualRenderer = function(container, theme) { // if the last row is unknown -> redraw everything if (lastRow === Infinity) { - this.showGutter && this.$gutterLayer.update(layerConfig); + if (this.showGutter) + this.$gutterLayer.update(layerConfig); this.$textLayer.update(layerConfig); return; } @@ -577,12 +584,12 @@ var VirtualRenderer = function(container, theme) { this.addGutterDecoration = function(row, className){ this.$gutterLayer.addGutterDecoration(row, className); this.$loop.schedule(this.CHANGE_GUTTER); - } + }; this.removeGutterDecoration = function(row, className){ this.$gutterLayer.removeGutterDecoration(row, className); this.$loop.schedule(this.CHANGE_GUTTER); - } + }; this.setBreakpoints = function(rows) { this.$gutterLayer.setBreakpoints(rows); @@ -636,7 +643,7 @@ var VirtualRenderer = function(container, theme) { else this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth)); } - }, + }; this.getScrollTop = function() { return this.scrollTop; @@ -652,7 +659,7 @@ var VirtualRenderer = function(container, theme) { this.getScrollBottomRow = function() { return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1); - } + }; this.scrollToRow = function(row) { this.scrollToY(row * this.lineHeight); @@ -714,7 +721,7 @@ var VirtualRenderer = function(container, theme) { return { pageX: canvasPos.left + x - this.getScrollLeft(), pageY: canvasPos.top + y - this.getScrollTop() - } + }; }; this.visualizeFocus = function() { @@ -760,6 +767,7 @@ var VirtualRenderer = function(container, theme) { this.setTheme = function(theme) { var _self = this; + this.$themeValue = theme; if (!theme || typeof theme == "string") { theme = theme || "ace/theme/textmate"; @@ -770,7 +778,6 @@ var VirtualRenderer = function(container, theme) { afterLoad(theme); } - var _self = this; function afterLoad(theme) { if (_self.$theme) dom.removeCssClass(_self.container, _self.$theme); @@ -790,24 +797,24 @@ var VirtualRenderer = function(container, theme) { this.getTheme = function() { return this.$themeValue; - } + }; // Methods allows to add / remove CSS classnames to the editor element. // This feature can be used by plug-ins to provide a visual indication of // a certain mode that editor is in. this.setStyle = function setStyle(style) { - dom.addCssClass(this.container, style) + dom.addCssClass(this.container, style); }; this.unsetStyle = function unsetStyle(style) { - dom.removeCssClass(this.container, style) + dom.removeCssClass(this.container, style); }; this.destroy = function() { this.$textLayer.destroy(); this.$cursorLayer.destroy(); - } + }; }).call(VirtualRenderer.prototype);