diff --git a/experiments/debug_mem_leak.html b/experiments/debug_mem_leak.html new file mode 100644 index 00000000..b8ee8726 --- /dev/null +++ b/experiments/debug_mem_leak.html @@ -0,0 +1,59 @@ + + + + + + + + +

+ +
+ + + \ No newline at end of file diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js index 7e5674ae..d3b41b65 100644 --- a/lib/ace/autocomplete.js +++ b/lib/ace/autocomplete.js @@ -142,7 +142,7 @@ var Autocomplete = function() { // we have to check if activeElement is a child of popup because // on IE preventDefault doesn't stop scrollbar from being focussed var el = document.activeElement; - var text = this.editor.textInput.getElement() + var text = this.editor.textInput.getElement(); if (el != text && ( !this.popup || el.parentNode != this.popup.container ) && el != this.tooltipNode && e.relatedTarget != this.tooltipNode && e.relatedTarget != text @@ -349,7 +349,7 @@ var Autocomplete = function() { doc = selected; if (typeof doc == "string") - doc = {docText: doc} + doc = {docText: doc}; if (!doc || !(doc.docHTML || doc.docText)) return this.hideDocTooltip(); this.showDocTooltip(doc); @@ -416,7 +416,7 @@ Autocomplete.startCommand = { bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space" }; -var FilteredList = function(array, filterText, mutateData) { +var FilteredList = function(array, filterText) { this.all = array; this.filtered = array; this.filterText = filterText || ""; diff --git a/lib/ace/autocomplete/popup.js b/lib/ace/autocomplete/popup.js index a151c746..ead0c47c 100644 --- a/lib/ace/autocomplete/popup.js +++ b/lib/ace/autocomplete/popup.js @@ -31,7 +31,6 @@ define(function(require, exports, module) { "use strict"; -var EditSession = require("../edit_session").EditSession; var Renderer = require("../virtual_renderer").VirtualRenderer; var Editor = require("../editor").Editor; var Range = require("../range").Range; diff --git a/lib/ace/config.js b/lib/ace/config.js index 34bf50fd..fe9312fd 100644 --- a/lib/ace/config.js +++ b/lib/ace/config.js @@ -39,7 +39,7 @@ var AppConfig = require("./lib/app_config").AppConfig; module.exports = exports = new AppConfig(); var global = (function() { - return this; + return this || typeof window != "undefined" && window; })(); var options = { diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index cef995c8..87eb67b3 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -422,3 +422,30 @@ position: absolute; z-index: 8; } + +/* +styles = [] +for (var i = 1; i < 16; i++) { + styles.push(".ace_br" + i + "{" + ( + ["top-left", "top-right", "bottom-right", "bottom-left"] + ).map(function(x, j) { + return i & (1< next, row == end), + layerConfig, row == end ? 0 : 1, extraStyle); } }; @@ -136,7 +137,7 @@ var Marker = function(parentEl) { extraStyle = extraStyle || ""; stringBuilder.push( - "
= 0; i--) { + ch = line[i]; + if (ch === '(') { + delta--; + isParen = true; + } else if (ch === '(' || ch === '[' || ch === '{') { + delta--; + isParen = false; + } else if (ch === ')' || ch === ']' || ch === '}') { + delta++; + } + if (delta < 0) { + break; + } + } + if (delta < 0 && isParen) { + // Were more brackets opened than closed and was a ( left open? + i += 1; + var iBefore = i; + var fn = ''; + while (true) { + ch = line[i]; + if (ch === ' ' || ch === '\t') { + if(this.minorIndentFunctions.indexOf(fn) !== -1) { + return this.$toIndent(line.substring(0, iBefore - 1) + tab); + } else { + return this.$toIndent(line.substring(0, i + 1)); + } + } else if (ch === undefined) { + return this.$toIndent(line.substring(0, iBefore - 1) + tab); + } + fn += line[i]; + i++; + } + } else if(delta < 0 && !isParen) { + // Were more brackets openend than closed and was it not a (? + return this.$toIndent(line.substring(0, i+1)); + } else if(delta > 0) { + // Mere more brackets closed than opened? Outdent. + baseIndent = baseIndent.substring(0, baseIndent.length - tab.length); + return baseIndent; + } else { + // Were they nicely matched? Just indent like line before. + return baseIndent; + } + }; + + this.getNextLineIndent = function(state, line, tab) { + return this.$calculateIndent(line, tab); + }; + + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; this.$id = "ace/mode/scheme"; }).call(Mode.prototype); diff --git a/lib/ace/theme/clouds.css b/lib/ace/theme/clouds.css index e3884e02..c11308d4 100644 --- a/lib/ace/theme/clouds.css +++ b/lib/ace/theme/clouds.css @@ -23,7 +23,6 @@ .ace-clouds.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #FFFFFF; - border-radius: 2px } .ace-clouds .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/clouds_midnight.css b/lib/ace/theme/clouds_midnight.css index 3b932996..08ee089d 100644 --- a/lib/ace/theme/clouds_midnight.css +++ b/lib/ace/theme/clouds_midnight.css @@ -23,7 +23,6 @@ .ace-clouds-midnight.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #191919; - border-radius: 2px } .ace-clouds-midnight .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/cobalt.css b/lib/ace/theme/cobalt.css index 73140082..b883ba97 100644 --- a/lib/ace/theme/cobalt.css +++ b/lib/ace/theme/cobalt.css @@ -23,7 +23,6 @@ .ace-cobalt.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #002240; - border-radius: 2px } .ace-cobalt .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/dawn.css b/lib/ace/theme/dawn.css index 719f4877..3c2884e1 100644 --- a/lib/ace/theme/dawn.css +++ b/lib/ace/theme/dawn.css @@ -23,7 +23,6 @@ .ace-dawn.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #F9F9F9; - border-radius: 2px } .ace-dawn .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/idle_fingers.css b/lib/ace/theme/idle_fingers.css index f507ec10..b5e1bff2 100644 --- a/lib/ace/theme/idle_fingers.css +++ b/lib/ace/theme/idle_fingers.css @@ -23,7 +23,6 @@ .ace-idle-fingers.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #323232; - border-radius: 2px } .ace-idle-fingers .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/katzenmilch.css b/lib/ace/theme/katzenmilch.css index 0b5a7a23..bf1569fb 100644 --- a/lib/ace/theme/katzenmilch.css +++ b/lib/ace/theme/katzenmilch.css @@ -31,7 +31,6 @@ .ace-katzenmilch.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #f3f2f3; - border-radius: 2px } .ace-katzenmilch .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/kr_theme.css b/lib/ace/theme/kr_theme.css index 339786ad..e232de47 100644 --- a/lib/ace/theme/kr_theme.css +++ b/lib/ace/theme/kr_theme.css @@ -23,7 +23,6 @@ .ace-kr-theme.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #0B0A09; - border-radius: 2px } .ace-kr-theme .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/merbivore.css b/lib/ace/theme/merbivore.css index a84ec3a6..9be25c66 100644 --- a/lib/ace/theme/merbivore.css +++ b/lib/ace/theme/merbivore.css @@ -23,7 +23,6 @@ .ace-merbivore.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #161616; - border-radius: 2px } .ace-merbivore .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/merbivore_soft.css b/lib/ace/theme/merbivore_soft.css index f0ad0bac..0d615376 100644 --- a/lib/ace/theme/merbivore_soft.css +++ b/lib/ace/theme/merbivore_soft.css @@ -23,7 +23,6 @@ .ace-merbivore-soft.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #1C1C1C; - border-radius: 2px } .ace-merbivore-soft .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/mono_industrial.css b/lib/ace/theme/mono_industrial.css index 7e40a3b9..6630e4a2 100644 --- a/lib/ace/theme/mono_industrial.css +++ b/lib/ace/theme/mono_industrial.css @@ -23,7 +23,6 @@ .ace-mono-industrial.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #222C28; - border-radius: 2px } .ace-mono-industrial .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/monokai.css b/lib/ace/theme/monokai.css index a3a063df..bcc26ef4 100644 --- a/lib/ace/theme/monokai.css +++ b/lib/ace/theme/monokai.css @@ -23,7 +23,6 @@ .ace-monokai.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #272822; - border-radius: 2px } .ace-monokai .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/pastel_on_dark.css b/lib/ace/theme/pastel_on_dark.css index 8cab16a1..0b637174 100644 --- a/lib/ace/theme/pastel_on_dark.css +++ b/lib/ace/theme/pastel_on_dark.css @@ -23,7 +23,6 @@ .ace-pastel-on-dark.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #2C2828; - border-radius: 2px } .ace-pastel-on-dark .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/solarized_dark.css b/lib/ace/theme/solarized_dark.css index ea8ec8aa..09740e69 100644 --- a/lib/ace/theme/solarized_dark.css +++ b/lib/ace/theme/solarized_dark.css @@ -30,7 +30,6 @@ .ace-solarized-dark.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #002B36; - border-radius: 2px } .ace-solarized-dark .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/solarized_light.css b/lib/ace/theme/solarized_light.css index 64c4bac9..65399fda 100644 --- a/lib/ace/theme/solarized_light.css +++ b/lib/ace/theme/solarized_light.css @@ -23,7 +23,6 @@ .ace-solarized-light.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #FDF6E3; - border-radius: 2px } .ace-solarized-light .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css index 3636a03d..f23a9ad6 100644 --- a/lib/ace/theme/terminal.css +++ b/lib/ace/theme/terminal.css @@ -23,7 +23,6 @@ .ace-terminal-theme.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px black; - border-radius: 2px } .ace-terminal-theme .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/textmate.css b/lib/ace/theme/textmate.css index 6cb159ba..18e2b4ee 100644 --- a/lib/ace/theme/textmate.css +++ b/lib/ace/theme/textmate.css @@ -122,7 +122,6 @@ } .ace-tm.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px white; - border-radius: 2px; } .ace-tm .ace_marker-layer .ace_step { background: rgb(252, 255, 0); diff --git a/lib/ace/theme/tomorrow.css b/lib/ace/theme/tomorrow.css index 20975004..77407e66 100644 --- a/lib/ace/theme/tomorrow.css +++ b/lib/ace/theme/tomorrow.css @@ -23,7 +23,6 @@ .ace-tomorrow.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #FFFFFF; - border-radius: 2px } .ace-tomorrow .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/tomorrow_night.css b/lib/ace/theme/tomorrow_night.css index aafceab6..e98a6580 100644 --- a/lib/ace/theme/tomorrow_night.css +++ b/lib/ace/theme/tomorrow_night.css @@ -23,7 +23,6 @@ .ace-tomorrow-night.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #1D1F21; - border-radius: 2px } .ace-tomorrow-night .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/tomorrow_night_blue.css b/lib/ace/theme/tomorrow_night_blue.css index e717be0a..907eef35 100644 --- a/lib/ace/theme/tomorrow_night_blue.css +++ b/lib/ace/theme/tomorrow_night_blue.css @@ -24,7 +24,6 @@ .ace-tomorrow-night-blue.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #002451; - border-radius: 2px } .ace-tomorrow-night-blue .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/tomorrow_night_bright.css b/lib/ace/theme/tomorrow_night_bright.css index 5c896fb9..c0c33739 100644 --- a/lib/ace/theme/tomorrow_night_bright.css +++ b/lib/ace/theme/tomorrow_night_bright.css @@ -23,7 +23,6 @@ .ace-tomorrow-night-bright.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #000000; - border-radius: 2px } .ace-tomorrow-night-bright .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/tomorrow_night_eighties.css b/lib/ace/theme/tomorrow_night_eighties.css index 85d7b089..69277fb1 100644 --- a/lib/ace/theme/tomorrow_night_eighties.css +++ b/lib/ace/theme/tomorrow_night_eighties.css @@ -24,7 +24,6 @@ .ace-tomorrow-night-eighties.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #2D2D2D; - border-radius: 2px } .ace-tomorrow-night-eighties .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/twilight.css b/lib/ace/theme/twilight.css index 0ca694fb..ae353dae 100644 --- a/lib/ace/theme/twilight.css +++ b/lib/ace/theme/twilight.css @@ -23,7 +23,6 @@ .ace-twilight.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #141414; - border-radius: 2px } .ace-twilight .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/vibrant_ink.css b/lib/ace/theme/vibrant_ink.css index e2901156..a3a89402 100644 --- a/lib/ace/theme/vibrant_ink.css +++ b/lib/ace/theme/vibrant_ink.css @@ -23,7 +23,6 @@ .ace-vibrant-ink.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #0F0F0F; - border-radius: 2px } .ace-vibrant-ink .ace_marker-layer .ace_step { diff --git a/lib/ace/theme/xcode.css b/lib/ace/theme/xcode.css index 56eb9a89..a22bd169 100644 --- a/lib/ace/theme/xcode.css +++ b/lib/ace/theme/xcode.css @@ -25,7 +25,6 @@ .ace-xcode.ace_multiselect .ace_selection.ace_start { box-shadow: 0 0 3px 0px #FFFFFF; - border-radius: 2px } .ace-xcode .ace_marker-layer .ace_step {