couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [46/53] [abbrv] [partial] fauxton commit: updated refs/heads/master to 8699e98
Date Wed, 23 Mar 2016 12:24:48 GMT
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f5b0260e/assets/js/libs/ace/ext-textarea.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/ext-textarea.js b/assets/js/libs/ace/ext-textarea.js
deleted file mode 100644
index 98fff05..0000000
--- a/assets/js/libs/ace/ext-textarea.js
+++ /dev/null
@@ -1,632 +0,0 @@
-define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
-"use strict";
-
-exports.isDark = false;
-exports.cssClass = "ace-tm";
-exports.cssText = ".ace-tm .ace_gutter {\
-background: #f0f0f0;\
-color: #333;\
-}\
-.ace-tm .ace_print-margin {\
-width: 1px;\
-background: #e8e8e8;\
-}\
-.ace-tm .ace_fold {\
-background-color: #6B72E6;\
-}\
-.ace-tm {\
-background-color: #FFFFFF;\
-color: black;\
-}\
-.ace-tm .ace_cursor {\
-color: black;\
-}\
-.ace-tm .ace_invisible {\
-color: rgb(191, 191, 191);\
-}\
-.ace-tm .ace_storage,\
-.ace-tm .ace_keyword {\
-color: blue;\
-}\
-.ace-tm .ace_constant {\
-color: rgb(197, 6, 11);\
-}\
-.ace-tm .ace_constant.ace_buildin {\
-color: rgb(88, 72, 246);\
-}\
-.ace-tm .ace_constant.ace_language {\
-color: rgb(88, 92, 246);\
-}\
-.ace-tm .ace_constant.ace_library {\
-color: rgb(6, 150, 14);\
-}\
-.ace-tm .ace_invalid {\
-background-color: rgba(255, 0, 0, 0.1);\
-color: red;\
-}\
-.ace-tm .ace_support.ace_function {\
-color: rgb(60, 76, 114);\
-}\
-.ace-tm .ace_support.ace_constant {\
-color: rgb(6, 150, 14);\
-}\
-.ace-tm .ace_support.ace_type,\
-.ace-tm .ace_support.ace_class {\
-color: rgb(109, 121, 222);\
-}\
-.ace-tm .ace_keyword.ace_operator {\
-color: rgb(104, 118, 135);\
-}\
-.ace-tm .ace_string {\
-color: rgb(3, 106, 7);\
-}\
-.ace-tm .ace_comment {\
-color: rgb(76, 136, 107);\
-}\
-.ace-tm .ace_comment.ace_doc {\
-color: rgb(0, 102, 255);\
-}\
-.ace-tm .ace_comment.ace_doc.ace_tag {\
-color: rgb(128, 159, 191);\
-}\
-.ace-tm .ace_constant.ace_numeric {\
-color: rgb(0, 0, 205);\
-}\
-.ace-tm .ace_variable {\
-color: rgb(49, 132, 149);\
-}\
-.ace-tm .ace_xml-pe {\
-color: rgb(104, 104, 91);\
-}\
-.ace-tm .ace_entity.ace_name.ace_function {\
-color: #0000A2;\
-}\
-.ace-tm .ace_heading {\
-color: rgb(12, 7, 255);\
-}\
-.ace-tm .ace_list {\
-color:rgb(185, 6, 144);\
-}\
-.ace-tm .ace_meta.ace_tag {\
-color:rgb(0, 22, 142);\
-}\
-.ace-tm .ace_string.ace_regex {\
-color: rgb(255, 0, 0)\
-}\
-.ace-tm .ace_marker-layer .ace_selection {\
-background: rgb(181, 213, 255);\
-}\
-.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);\
-}\
-.ace-tm .ace_marker-layer .ace_stack {\
-background: rgb(164, 229, 101);\
-}\
-.ace-tm .ace_marker-layer .ace_bracket {\
-margin: -1px 0 0 -1px;\
-border: 1px solid rgb(192, 192, 192);\
-}\
-.ace-tm .ace_marker-layer .ace_active-line {\
-background: rgba(0, 0, 0, 0.07);\
-}\
-.ace-tm .ace_gutter-active-line {\
-background-color : #dcdcdc;\
-}\
-.ace-tm .ace_marker-layer .ace_selected-word {\
-background: rgb(250, 250, 255);\
-border: 1px solid rgb(200, 200, 250);\
-}\
-.ace-tm .ace_indent-guide {\
-background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
-}\
-";
-
-var dom = require("../lib/dom");
-dom.importCssString(exports.cssText, exports.cssClass);
-});
-
-define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"], function(require, exports, module) {
-"use strict";
-
-require("./lib/fixoldbrowsers");
-
-var dom = require("./lib/dom");
-var event = require("./lib/event");
-
-var Editor = require("./editor").Editor;
-var EditSession = require("./edit_session").EditSession;
-var UndoManager = require("./undomanager").UndoManager;
-var Renderer = require("./virtual_renderer").VirtualRenderer;
-require("./worker/worker_client");
-require("./keyboard/hash_handler");
-require("./placeholder");
-require("./multi_select");
-require("./mode/folding/fold_mode");
-require("./theme/textmate");
-require("./ext/error_marker");
-
-exports.config = require("./config");
-exports.require = require;
-exports.edit = function(el) {
-    if (typeof(el) == "string") {
-        var _id = el;
-        el = document.getElementById(_id);
-        if (!el)
-            throw new Error("ace.edit can't find div #" + _id);
-    }
-
-    if (el && el.env && el.env.editor instanceof Editor)
-        return el.env.editor;
-
-    var value = "";
-    if (el && /input|textarea/i.test(el.tagName)) {
-        var oldNode = el;
-        value = oldNode.value;
-        el = dom.createElement("pre");
-        oldNode.parentNode.replaceChild(el, oldNode);
-    } else {
-        value = dom.getInnerText(el);
-        el.innerHTML = '';
-    }
-
-    var doc = exports.createEditSession(value);
-
-    var editor = new Editor(new Renderer(el));
-    editor.setSession(doc);
-
-    var env = {
-        document: doc,
-        editor: editor,
-        onResize: editor.resize.bind(editor, null)
-    };
-    if (oldNode) env.textarea = oldNode;
-    event.addListener(window, "resize", env.onResize);
-    editor.on("destroy", function() {
-        event.removeListener(window, "resize", env.onResize);
-        env.editor.container.env = null; // prevent memory leak on old ie
-    });
-    editor.container.env = editor.env = env;
-    return editor;
-};
-exports.createEditSession = function(text, mode) {
-    var doc = new EditSession(text, mode);
-    doc.setUndoManager(new UndoManager());
-    return doc;
-}
-exports.EditSession = EditSession;
-exports.UndoManager = UndoManager;
-});
-
-define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate"], function(require, exports, module) {
-"use strict";
-
-var event = require("../lib/event");
-var UA = require("../lib/useragent");
-var net = require("../lib/net");
-var ace = require("../ace");
-
-require("../theme/textmate");
-
-module.exports = exports = ace;
-var getCSSProperty = function(element, container, property) {
-    var ret = element.style[property];
-
-    if (!ret) {
-        if (window.getComputedStyle) {
-            ret = window.getComputedStyle(element, '').getPropertyValue(property);
-        } else {
-            ret = element.currentStyle[property];
-        }
-    }
-
-    if (!ret || ret == 'auto' || ret == 'intrinsic') {
-        ret = container.style[property];
-    }
-    return ret;
-};
-
-function applyStyles(elm, styles) {
-    for (var style in styles) {
-        elm.style[style] = styles[style];
-    }
-}
-
-function setupContainer(element, getValue) {
-    if (element.type != 'textarea') {
-        throw new Error("Textarea required!");
-    }
-
-    var parentNode = element.parentNode;
-    var container = document.createElement('div');
-    var resizeEvent = function() {
-        var style = 'position:relative;';
-        [
-            'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
-        ].forEach(function(item) {
-            style += item + ':' +
-                        getCSSProperty(element, container, item) + ';';
-        });
-        var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
-        var height = getCSSProperty(element, container, 'height')  || (element.clientHeight + "px");
-        style += 'height:' + height + ';width:' + width + ';';
-        style += 'display:inline-block;';
-        container.setAttribute('style', style);
-    };
-    event.addListener(window, 'resize', resizeEvent);
-    resizeEvent();
-    parentNode.insertBefore(container, element.nextSibling);
-    while (parentNode !== document) {
-        if (parentNode.tagName.toUpperCase() === 'FORM') {
-            var oldSumit = parentNode.onsubmit;
-            parentNode.onsubmit = function(evt) {
-                element.value = getValue();
-                if (oldSumit) {
-                    oldSumit.call(this, evt);
-                }
-            };
-            break;
-        }
-        parentNode = parentNode.parentNode;
-    }
-    return container;
-}
-
-exports.transformTextarea = function(element, options) {
-    var session;
-    var container = setupContainer(element, function() {
-        return session.getValue();
-    });
-    element.style.display = 'none';
-    container.style.background = 'white';
-    var editorDiv = document.createElement("div");
-    applyStyles(editorDiv, {
-        top: "0px",
-        left: "0px",
-        right: "0px",
-        bottom: "0px",
-        border: "1px solid gray",
-        position: "absolute"
-    });
-    container.appendChild(editorDiv);
-
-    var settingOpener = document.createElement("div");
-    applyStyles(settingOpener, {
-        position: "absolute",
-        right: "0px",
-        bottom: "0px",
-        background: "red",
-        cursor: "nw-resize",
-        borderStyle: "solid",
-        borderWidth: "9px 8px 10px 9px",
-        width: "2px",
-        borderColor: "lightblue gray gray lightblue",
-        zIndex: 101
-    });
-
-    var settingDiv = document.createElement("div");
-    var settingDivStyles = {
-        top: "0px",
-        left: "20%",
-        right: "0px",
-        bottom: "0px",
-        position: "absolute",
-        padding: "5px",
-        zIndex: 100,
-        color: "white",
-        display: "none",
-        overflow: "auto",
-        fontSize: "14px",
-        boxShadow: "-5px 2px 3px gray"
-    };
-    if (!UA.isOldIE) {
-        settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
-    } else {
-        settingDivStyles.backgroundColor = "#333";
-    }
-
-    applyStyles(settingDiv, settingDivStyles);
-    container.appendChild(settingDiv);
-
-    options = options || exports.defaultOptions;
-    var editor = ace.edit(editorDiv);
-    session = editor.getSession();
-
-    session.setValue(element.value || element.innerHTML);
-    editor.focus();
-    container.appendChild(settingOpener);
-    setupApi(editor, editorDiv, settingDiv, ace, options, load);
-    setupSettingPanel(settingDiv, settingOpener, editor);
-
-    var state = "";
-    event.addListener(settingOpener, "mousemove", function(e) {
-        var rect = this.getBoundingClientRect();
-        var x = e.clientX - rect.left, y = e.clientY - rect.top;
-        if (x + y < (rect.width + rect.height)/2) {
-            this.style.cursor = "pointer";
-            state = "toggle";
-        } else {
-            state = "resize";
-            this.style.cursor = "nw-resize";
-        }
-    });
-
-    event.addListener(settingOpener, "mousedown", function(e) {
-        if (state == "toggle") {
-            editor.setDisplaySettings();
-            return;
-        }
-        container.style.zIndex = 100000;
-        var rect = container.getBoundingClientRect();
-        var startX = rect.width  + rect.left - e.clientX;
-        var startY = rect.height  + rect.top - e.clientY;
-        event.capture(settingOpener, function(e) {
-            container.style.width = e.clientX - rect.left + startX + "px";
-            container.style.height = e.clientY - rect.top + startY + "px";
-            editor.resize();
-        }, function() {});
-    });
-
-    return editor;
-};
-
-function load(url, module, callback) {
-    net.loadScript(url, function() {
-        require([module], callback);
-    });
-}
-
-function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
-    var session = editor.getSession();
-    var renderer = editor.renderer;
-    loader = loader || load;
-
-    function toBool(value) {
-        return value === "true" || value == true;
-    }
-
-    editor.setDisplaySettings = function(display) {
-        if (display == null)
-            display = settingDiv.style.display == "none";
-        if (display) {
-            settingDiv.style.display = "block";
-            settingDiv.hideButton.focus();
-            editor.on("focus", function onFocus() {
-                editor.removeListener("focus", onFocus);
-                settingDiv.style.display = "none";
-            });
-        } else {
-            editor.focus();
-        }
-    };
-
-    editor.$setOption = editor.setOption;
-    editor.$getOption = editor.getOption;
-    editor.setOption = function(key, value) {
-        switch (key) {
-            case "mode":
-                editor.$setOption("mode", "ace/mode/" + value)
-            break;
-            case "theme":
-                editor.$setOption("theme", "ace/theme/" + value)
-            break;
-            case "keybindings":
-                switch (value) {
-                    case "vim":
-                        editor.setKeyboardHandler("ace/keyboard/vim");
-                        break;
-                    case "emacs":
-                        editor.setKeyboardHandler("ace/keyboard/emacs");
-                        break;
-                    default:
-                        editor.setKeyboardHandler(null);
-                }
-            break;
-
-            case "softWrap":
-            case "fontSize":
-                editor.$setOption(key, value);
-            break;
-            
-            default:
-                editor.$setOption(key, toBool(value));
-        }
-    };
-
-    editor.getOption = function(key) {
-        switch (key) {
-            case "mode":
-                return editor.$getOption("mode").substr("ace/mode/".length)
-            break;
-
-            case "theme":
-                return editor.$getOption("theme").substr("ace/theme/".length)
-            break;
-
-            case "keybindings":
-                var value = editor.getKeyboardHandler()
-                switch (value && value.$id) {
-                    case "ace/keyboard/vim":
-                        return "vim";
-                    case "ace/keyboard/emacs":
-                        return "emacs";
-                    default:
-                        return "ace";
-                }
-            break;
-
-            default:
-                return editor.$getOption(key);
-        }
-    };
-
-    editor.setOptions(options);
-    return editor;
-}
-
-function setupSettingPanel(settingDiv, settingOpener, editor) {
-    var BOOL = null;
-
-    var desc = {
-        mode:            "Mode:",
-        wrap:            "Soft Wrap:",
-        theme:           "Theme:",
-        fontSize:        "Font Size:",
-        showGutter:      "Display Gutter:",
-        keybindings:     "Keyboard",
-        showPrintMargin: "Show Print Margin:",
-        useSoftTabs:     "Use Soft Tabs:",
-        showInvisibles:  "Show Invisibles"
-    };
-
-    var optionValues = {
-        mode: {
-            text:       "Plain",
-            javascript: "JavaScript",
-            xml:        "XML",
-            html:       "HTML",
-            css:        "CSS",
-            scss:       "SCSS",
-            python:     "Python",
-            php:        "PHP",
-            java:       "Java",
-            ruby:       "Ruby",
-            c_cpp:      "C/C++",
-            coffee:     "CoffeeScript",
-            json:       "json",
-            perl:       "Perl",
-            clojure:    "Clojure",
-            ocaml:      "OCaml",
-            csharp:     "C#",
-            haxe:       "haXe",
-            svg:        "SVG",
-            textile:    "Textile",
-            groovy:     "Groovy",
-            liquid:     "Liquid",
-            Scala:      "Scala"
-        },
-        theme: {
-            clouds:           "Clouds",
-            clouds_midnight:  "Clouds Midnight",
-            cobalt:           "Cobalt",
-            crimson_editor:   "Crimson Editor",
-            dawn:             "Dawn",
-            eclipse:          "Eclipse",
-            idle_fingers:     "Idle Fingers",
-            kr_theme:         "Kr Theme",
-            merbivore:        "Merbivore",
-            merbivore_soft:   "Merbivore Soft",
-            mono_industrial:  "Mono Industrial",
-            monokai:          "Monokai",
-            pastel_on_dark:   "Pastel On Dark",
-            solarized_dark:   "Solarized Dark",
-            solarized_light:  "Solarized Light",
-            textmate:         "Textmate",
-            twilight:         "Twilight",
-            vibrant_ink:      "Vibrant Ink"
-        },
-        showGutter: BOOL,
-        fontSize: {
-            "10px": "10px",
-            "11px": "11px",
-            "12px": "12px",
-            "14px": "14px",
-            "16px": "16px"
-        },
-        wrap: {
-            off:    "Off",
-            40:     "40",
-            80:     "80",
-            free:   "Free"
-        },
-        keybindings: {
-            ace: "ace",
-            vim: "vim",
-            emacs: "emacs"
-        },
-        showPrintMargin:    BOOL,
-        useSoftTabs:        BOOL,
-        showInvisibles:     BOOL
-    };
-
-    var table = [];
-    table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
-
-    function renderOption(builder, option, obj, cValue) {
-        if (!obj) {
-            builder.push(
-                "<input type='checkbox' title='", option, "' ",
-                    cValue + "" == "true" ? "checked='true'" : "",
-               "'></input>"
-            );
-            return;
-        }
-        builder.push("<select title='" + option + "'>");
-        for (var value in obj) {
-            builder.push("<option value='" + value + "' ");
-
-            if (cValue == value) {
-                builder.push(" selected ");
-            }
-
-            builder.push(">",
-                obj[value],
-                "</option>");
-        }
-        builder.push("</select>");
-    }
-
-    for (var option in exports.defaultOptions) {
-        table.push("<tr><td>", desc[option], "</td>");
-        table.push("<td>");
-        renderOption(table, option, optionValues[option], editor.getOption(option));
-        table.push("</td></tr>");
-    }
-    table.push("</table>");
-    settingDiv.innerHTML = table.join("");
-
-    var onChange = function(e) {
-        var select = e.currentTarget;
-        editor.setOption(select.title, select.value);
-    };
-    var onClick = function(e) {
-        var cb = e.currentTarget;
-        editor.setOption(cb.title, cb.checked);
-    };
-    var selects = settingDiv.getElementsByTagName("select");
-    for (var i = 0; i < selects.length; i++)
-        selects[i].onchange = onChange;
-    var cbs = settingDiv.getElementsByTagName("input");
-    for (var i = 0; i < cbs.length; i++)
-        cbs[i].onclick = onClick;
-
-
-    var button = document.createElement("input");
-    button.type = "button";
-    button.value = "Hide";
-    event.addListener(button, "click", function() {
-        editor.setDisplaySettings(false);
-    });
-    settingDiv.appendChild(button);
-    settingDiv.hideButton = button;
-}
-exports.defaultOptions = {
-    mode:               "javascript",
-    theme:              "textmate",
-    wrap:               "off",
-    fontSize:           "12px",
-    showGutter:         "false",
-    keybindings:        "ace",
-    showPrintMargin:    "false",
-    useSoftTabs:        "true",
-    showInvisibles:     "false"
-};
-
-});
-                (function() {
-                    window.require(["ace/ext/textarea"], function() {});
-                })();
-            
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f5b0260e/assets/js/libs/ace/ext-themelist.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/ext-themelist.js b/assets/js/libs/ace/ext-themelist.js
deleted file mode 100644
index 5c5a60a..0000000
--- a/assets/js/libs/ace/ext-themelist.js
+++ /dev/null
@@ -1,58 +0,0 @@
-define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
-"use strict";
-require("ace/lib/fixoldbrowsers");
-
-var themeData = [
-    ["Chrome"         ],
-    ["Clouds"         ],
-    ["Crimson Editor" ],
-    ["Dawn"           ],
-    ["Dreamweaver"    ],
-    ["Eclipse"        ],
-    ["GitHub"         ],
-    ["Solarized Light"],
-    ["TextMate"       ],
-    ["Tomorrow"       ],
-    ["XCode"          ],
-    ["Kuroir"],
-    ["KatzenMilch"],
-    ["Ambiance"             ,"ambiance"                ,  "dark"],
-    ["Chaos"                ,"chaos"                   ,  "dark"],
-    ["Clouds Midnight"      ,"clouds_midnight"         ,  "dark"],
-    ["Cobalt"               ,"cobalt"                  ,  "dark"],
-    ["idle Fingers"         ,"idle_fingers"            ,  "dark"],
-    ["krTheme"              ,"kr_theme"                ,  "dark"],
-    ["Merbivore"            ,"merbivore"               ,  "dark"],
-    ["Merbivore Soft"       ,"merbivore_soft"          ,  "dark"],
-    ["Mono Industrial"      ,"mono_industrial"         ,  "dark"],
-    ["Monokai"              ,"monokai"                 ,  "dark"],
-    ["Pastel on dark"       ,"pastel_on_dark"          ,  "dark"],
-    ["Solarized Dark"       ,"solarized_dark"          ,  "dark"],
-    ["Terminal"             ,"terminal"                ,  "dark"],
-    ["Tomorrow Night"       ,"tomorrow_night"          ,  "dark"],
-    ["Tomorrow Night Blue"  ,"tomorrow_night_blue"     ,  "dark"],
-    ["Tomorrow Night Bright","tomorrow_night_bright"   ,  "dark"],
-    ["Tomorrow Night 80s"   ,"tomorrow_night_eighties" ,  "dark"],
-    ["Twilight"             ,"twilight"                ,  "dark"],
-    ["Vibrant Ink"          ,"vibrant_ink"             ,  "dark"]
-];
-
-
-exports.themesByName = {};
-exports.themes = themeData.map(function(data) {
-    var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
-    var theme = {
-        caption: data[0],
-        theme: "ace/theme/" + name,
-        isDark: data[2] == "dark",
-        name: name
-    };
-    exports.themesByName[name] = theme;
-    return theme;
-});
-
-});
-                (function() {
-                    window.require(["ace/ext/themelist"], function() {});
-                })();
-            
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f5b0260e/assets/js/libs/ace/ext-whitespace.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/ext-whitespace.js b/assets/js/libs/ace/ext-whitespace.js
deleted file mode 100644
index 4cc9759..0000000
--- a/assets/js/libs/ace/ext-whitespace.js
+++ /dev/null
@@ -1,181 +0,0 @@
-define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"], function(require, exports, module) {
-"use strict";
-
-var lang = require("../lib/lang");
-exports.$detectIndentation = function(lines, fallback) {
-    var stats = [];
-    var changes = [];
-    var tabIndents = 0;
-    var prevSpaces = 0;
-    var max = Math.min(lines.length, 1000);
-    for (var i = 0; i < max; i++) {
-        var line = lines[i];
-        if (!/^\s*[^*+\-\s]/.test(line))
-            continue;
-
-        if (line[0] == "\t")
-            tabIndents++;
-
-        var spaces = line.match(/^ */)[0].length;
-        if (spaces && line[spaces] != "\t") {
-            var diff = spaces - prevSpaces;
-            if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
-                changes[diff] = (changes[diff] || 0) + 1;
-
-            stats[spaces] = (stats[spaces] || 0) + 1;
-        }
-        prevSpaces = spaces;
-        while (i < max && line[line.length - 1] == "\\")
-            line = lines[i++];
-    }
-    
-    function getScore(indent) {
-        var score = 0;
-        for (var i = indent; i < stats.length; i += indent)
-            score += stats[i] || 0;
-        return score;
-    }
-
-    var changesTotal = changes.reduce(function(a,b){return a+b}, 0);
-
-    var first = {score: 0, length: 0};
-    var spaceIndents = 0;
-    for (var i = 1; i < 12; i++) {
-        var score = getScore(i);
-        if (i == 1) {
-            spaceIndents = score;
-            score = stats[1] ? 0.9 : 0.8;
-            if (!stats.length)
-                score = 0
-        } else
-            score /= spaceIndents;
-
-        if (changes[i])
-            score += changes[i] / changesTotal;
-
-        if (score > first.score)
-            first = {score: score, length: i};
-    }
-
-    if (first.score && first.score > 1.4)
-        var tabLength = first.length;
-
-    if (tabIndents > spaceIndents + 1)
-        return {ch: "\t", length: tabLength};
-
-    if (spaceIndents > tabIndents + 1)
-        return {ch: " ", length: tabLength};
-};
-
-exports.detectIndentation = function(session) {
-    var lines = session.getLines(0, 1000);
-    var indent = exports.$detectIndentation(lines) || {};
-
-    if (indent.ch)
-        session.setUseSoftTabs(indent.ch == " ");
-
-    if (indent.length)
-        session.setTabSize(indent.length);
-    return indent;
-};
-
-exports.trimTrailingSpace = function(session, trimEmpty) {
-    var doc = session.getDocument();
-    var lines = doc.getAllLines();
-    
-    var min = trimEmpty ? -1 : 0;
-
-    for (var i = 0, l=lines.length; i < l; i++) {
-        var line = lines[i];
-        var index = line.search(/\s+$/);
-
-        if (index > min)
-            doc.removeInLine(i, index, line.length);
-    }
-};
-
-exports.convertIndentation = function(session, ch, len) {
-    var oldCh = session.getTabString()[0];
-    var oldLen = session.getTabSize();
-    if (!len) len = oldLen;
-    if (!ch) ch = oldCh;
-
-    var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len);
-
-    var doc = session.doc;
-    var lines = doc.getAllLines();
-
-    var cache = {};
-    var spaceCache = {};
-    for (var i = 0, l=lines.length; i < l; i++) {
-        var line = lines[i];
-        var match = line.match(/^\s*/)[0];
-        if (match) {
-            var w = session.$getStringScreenWidth(match)[0];
-            var tabCount = Math.floor(w/oldLen);
-            var reminder = w%oldLen;
-            var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));
-            toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder));
-
-            if (toInsert != match) {
-                doc.removeInLine(i, 0, match.length);
-                doc.insertInLine({row: i, column: 0}, toInsert);
-            }
-        }
-    }
-    session.setTabSize(len);
-    session.setUseSoftTabs(ch == " ");
-};
-
-exports.$parseStringArg = function(text) {
-    var indent = {};
-    if (/t/.test(text))
-        indent.ch = "\t";
-    else if (/s/.test(text))
-        indent.ch = " ";
-    var m = text.match(/\d+/);
-    if (m)
-        indent.length = parseInt(m[0], 10);
-    return indent;
-};
-
-exports.$parseArg = function(arg) {
-    if (!arg)
-        return {};
-    if (typeof arg == "string")
-        return exports.$parseStringArg(arg);
-    if (typeof arg.text == "string")
-        return exports.$parseStringArg(arg.text);
-    return arg;
-};
-
-exports.commands = [{
-    name: "detectIndentation",
-    exec: function(editor) {
-        exports.detectIndentation(editor.session);
-    }
-}, {
-    name: "trimTrailingSpace",
-    exec: function(editor) {
-        exports.trimTrailingSpace(editor.session);
-    }
-}, {
-    name: "convertIndentation",
-    exec: function(editor, arg) {
-        var indent = exports.$parseArg(arg);
-        exports.convertIndentation(editor.session, indent.ch, indent.length);
-    }
-}, {
-    name: "setIndentation",
-    exec: function(editor, arg) {
-        var indent = exports.$parseArg(arg);
-        indent.length && editor.session.setTabSize(indent.length);
-        indent.ch && editor.session.setUseSoftTabs(indent.ch == " ");
-    }
-}];
-
-});
-                (function() {
-                    window.require(["ace/ext/whitespace"], function() {});
-                })();
-            
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f5b0260e/assets/js/libs/ace/keybinding-emacs.js
----------------------------------------------------------------------
diff --git a/assets/js/libs/ace/keybinding-emacs.js b/assets/js/libs/ace/keybinding-emacs.js
deleted file mode 100644
index 92c263c..0000000
--- a/assets/js/libs/ace/keybinding-emacs.js
+++ /dev/null
@@ -1,1182 +0,0 @@
-define("ace/occur",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/edit_session","ace/search_highlight","ace/lib/dom"], function(require, exports, module) {
-"use strict";
-
-var oop = require("./lib/oop");
-var Range = require("./range").Range;
-var Search = require("./search").Search;
-var EditSession = require("./edit_session").EditSession;
-var SearchHighlight = require("./search_highlight").SearchHighlight;
-function Occur() {}
-
-oop.inherits(Occur, Search);
-
-(function() {
-    this.enter = function(editor, options) {
-        if (!options.needle) return false;
-        var pos = editor.getCursorPosition();
-        this.displayOccurContent(editor, options);
-        var translatedPos = this.originalToOccurPosition(editor.session, pos);
-        editor.moveCursorToPosition(translatedPos);
-        return true;
-    }
-    this.exit = function(editor, options) {
-        var pos = options.translatePosition && editor.getCursorPosition();
-        var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
-        this.displayOriginalContent(editor);
-        if (translatedPos)
-            editor.moveCursorToPosition(translatedPos);
-        return true;
-    }
-
-    this.highlight = function(sess, regexp) {
-        var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(
-                new SearchHighlight(null, "ace_occur-highlight", "text"));
-        hl.setRegexp(regexp);
-        sess._emit("changeBackMarker"); // force highlight layer redraw
-    }
-
-    this.displayOccurContent = function(editor, options) {
-        this.$originalSession = editor.session;
-        var found = this.matchingLines(editor.session, options);
-        var lines = found.map(function(foundLine) { return foundLine.content; });
-        var occurSession = new EditSession(lines.join('\n'));
-        occurSession.$occur = this;
-        occurSession.$occurMatchingLines = found;
-        editor.setSession(occurSession);
-        this.$useEmacsStyleLineStart = this.$originalSession.$useEmacsStyleLineStart;
-        occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
-        this.highlight(occurSession, options.re);
-        occurSession._emit('changeBackMarker');
-    }
-
-    this.displayOriginalContent = function(editor) {
-        editor.setSession(this.$originalSession);
-        this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
-    }
-    this.originalToOccurPosition = function(session, pos) {
-        var lines = session.$occurMatchingLines;
-        var nullPos = {row: 0, column: 0};
-        if (!lines) return nullPos;
-        for (var i = 0; i < lines.length; i++) {
-            if (lines[i].row === pos.row)
-                return {row: i, column: pos.column};
-        }
-        return nullPos;
-    }
-    this.occurToOriginalPosition = function(session, pos) {
-        var lines = session.$occurMatchingLines;
-        if (!lines || !lines[pos.row])
-            return pos;
-        return {row: lines[pos.row].row, column: pos.column};
-    }
-
-    this.matchingLines = function(session, options) {
-        options = oop.mixin({}, options);
-        if (!session || !options.needle) return [];
-        var search = new Search();
-        search.set(options);
-        return search.findAll(session).reduce(function(lines, range) {
-            var row = range.start.row;
-            var last = lines[lines.length-1];
-            return last && last.row === row ?
-                lines :
-                lines.concat({row: row, content: session.getLine(row)});
-        }, []);
-    }
-
-}).call(Occur.prototype);
-
-var dom = require('./lib/dom');
-dom.importCssString(".ace_occur-highlight {\n\
-    border-radius: 4px;\n\
-    background-color: rgba(87, 255, 8, 0.25);\n\
-    position: absolute;\n\
-    z-index: 4;\n\
-    -moz-box-sizing: border-box;\n\
-    -webkit-box-sizing: border-box;\n\
-    box-sizing: border-box;\n\
-    box-shadow: 0 0 4px rgb(91, 255, 50);\n\
-}\n\
-.ace_dark .ace_occur-highlight {\n\
-    background-color: rgb(80, 140, 85);\n\
-    box-shadow: 0 0 4px rgb(60, 120, 70);\n\
-}\n", "incremental-occur-highlighting");
-
-exports.Occur = Occur;
-
-});
-
-define("ace/commands/occur_commands",["require","exports","module","ace/config","ace/occur","ace/keyboard/hash_handler","ace/lib/oop"], function(require, exports, module) {
-
-var config = require("../config"),
-    Occur = require("../occur").Occur;
-var occurStartCommand = {
-    name: "occur",
-    exec: function(editor, options) {
-        var alreadyInOccur = !!editor.session.$occur;
-        var occurSessionActive = new Occur().enter(editor, options);
-        if (occurSessionActive && !alreadyInOccur)
-            OccurKeyboardHandler.installIn(editor);
-    },
-    readOnly: true
-};
-
-var occurCommands = [{
-    name: "occurexit",
-    bindKey: 'esc|Ctrl-G',
-    exec: function(editor) {
-        var occur = editor.session.$occur;
-        if (!occur) return;
-        occur.exit(editor, {});
-        if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
-    },
-    readOnly: true
-}, {
-    name: "occuraccept",
-    bindKey: 'enter',
-    exec: function(editor) {
-        var occur = editor.session.$occur;
-        if (!occur) return;
-        occur.exit(editor, {translatePosition: true});
-        if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
-    },
-    readOnly: true
-}];
-
-var HashHandler = require("../keyboard/hash_handler").HashHandler;
-var oop = require("../lib/oop");
-
-
-function OccurKeyboardHandler() {}
-
-oop.inherits(OccurKeyboardHandler, HashHandler);
-
-;(function() {
-
-    this.isOccurHandler = true;
-
-    this.attach = function(editor) {
-        HashHandler.call(this, occurCommands, editor.commands.platform);
-        this.$editor = editor;
-    }
-
-    var handleKeyboard$super = this.handleKeyboard;
-    this.handleKeyboard = function(data, hashId, key, keyCode) {
-        var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
-        return (cmd && cmd.command) ? cmd : undefined;
-    }
-
-}).call(OccurKeyboardHandler.prototype);
-
-OccurKeyboardHandler.installIn = function(editor) {
-    var handler = new this();
-    editor.keyBinding.addKeyboardHandler(handler);
-    editor.commands.addCommands(occurCommands);
-}
-
-OccurKeyboardHandler.uninstallFrom = function(editor) {
-    editor.commands.removeCommands(occurCommands);
-    var handler = editor.getKeyboardHandler();
-    if (handler.isOccurHandler)
-        editor.keyBinding.removeKeyboardHandler(handler);
-}
-
-exports.occurStartCommand = occurStartCommand;
-
-});
-
-define("ace/commands/incremental_search_commands",["require","exports","module","ace/config","ace/lib/oop","ace/keyboard/hash_handler","ace/commands/occur_commands"], function(require, exports, module) {
-
-var config = require("../config");
-var oop = require("../lib/oop");
-var HashHandler = require("../keyboard/hash_handler").HashHandler;
-var occurStartCommand = require("./occur_commands").occurStartCommand;
-exports.iSearchStartCommands = [{
-    name: "iSearch",
-    bindKey: {win: "Ctrl-F", mac: "Command-F"},
-    exec: function(editor, options) {
-        config.loadModule(["core", "ace/incremental_search"], function(e) {
-            var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
-            iSearch.activate(editor, options.backwards);
-            if (options.jumpToFirstMatch) iSearch.next(options);
-        });
-    },
-    readOnly: true
-}, {
-    name: "iSearchBackwards",
-    exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },
-    readOnly: true
-}, {
-    name: "iSearchAndGo",
-    bindKey: {win: "Ctrl-K", mac: "Command-G"},
-    exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },
-    readOnly: true
-}, {
-    name: "iSearchBackwardsAndGo",
-    bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"},
-    exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },
-    readOnly: true
-}];
-exports.iSearchCommands = [{
-    name: "restartSearch",
-    bindKey: {win: "Ctrl-F", mac: "Command-F"},
-    exec: function(iSearch) {
-        iSearch.cancelSearch(true);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "searchForward",
-    bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
-    exec: function(iSearch, options) {
-        options.useCurrentOrPrevSearch = true;
-        iSearch.next(options);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "searchBackward",
-    bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
-    exec: function(iSearch, options) {
-        options.useCurrentOrPrevSearch = true;
-        options.backwards = true;
-        iSearch.next(options);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "extendSearchTerm",
-    exec: function(iSearch, string) {
-        iSearch.addString(string);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "extendSearchTermSpace",
-    bindKey: "space",
-    exec: function(iSearch) { iSearch.addString(' '); },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "shrinkSearchTerm",
-    bindKey: "backspace",
-    exec: function(iSearch) {
-        iSearch.removeChar();
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: 'confirmSearch',
-    bindKey: 'return',
-    exec: function(iSearch) { iSearch.deactivate(); },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: 'cancelSearch',
-    bindKey: 'esc|Ctrl-G',
-    exec: function(iSearch) { iSearch.deactivate(true); },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: 'occurisearch',
-    bindKey: 'Ctrl-O',
-    exec: function(iSearch) {
-        var options = oop.mixin({}, iSearch.$options);
-        iSearch.deactivate();
-        occurStartCommand.exec(iSearch.$editor, options);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "yankNextWord",
-    bindKey: "Ctrl-w",
-    exec: function(iSearch) {
-        var ed = iSearch.$editor,
-            range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }),
-            string = ed.session.getTextRange(range);
-        iSearch.addString(string);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: "yankNextChar",
-    bindKey: "Ctrl-Alt-y",
-    exec: function(iSearch) {
-        var ed = iSearch.$editor,
-            range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }),
-            string = ed.session.getTextRange(range);
-        iSearch.addString(string);
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: 'recenterTopBottom',
-    bindKey: 'Ctrl-l',
-    exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: 'selectAllMatches',
-    bindKey: 'Ctrl-space',
-    exec: function(iSearch) {
-        var ed = iSearch.$editor,
-            hl = ed.session.$isearchHighlight,
-            ranges = hl && hl.cache ? hl.cache
-                .reduce(function(ranges, ea) {
-                    return ranges.concat(ea ? ea : []); }, []) : [];
-        iSearch.deactivate(false);
-        ranges.forEach(ed.selection.addRange.bind(ed.selection));
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}, {
-    name: 'searchAsRegExp',
-    bindKey: 'Alt-r',
-    exec: function(iSearch) {
-        iSearch.convertNeedleToRegExp();
-    },
-    readOnly: true,
-    isIncrementalSearchCommand: true
-}];
-
-function IncrementalSearchKeyboardHandler(iSearch) {
-    this.$iSearch = iSearch;
-}
-
-oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
-
-;(function() {
-
-    this.attach = function(editor) {
-        var iSearch = this.$iSearch;
-        HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
-        this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
-            if (!e.command.isIncrementalSearchCommand) return undefined;
-            e.stopPropagation();
-            e.preventDefault();
-            return e.command.exec(iSearch, e.args || {});
-        });
-    }
-
-    this.detach = function(editor) {
-        if (!this.$commandExecHandler) return;
-        editor.commands.removeEventListener('exec', this.$commandExecHandler);
-        delete this.$commandExecHandler;
-    }
-
-    var handleKeyboard$super = this.handleKeyboard;
-    this.handleKeyboard = function(data, hashId, key, keyCode) {
-        if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v')
-         || (hashId === 1/*ctrl*/ && key === 'y')) return null;
-        var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
-        if (cmd.command) { return cmd; }
-        if (hashId == -1) {
-            var extendCmd = this.commands.extendSearchTerm;
-            if (extendCmd) { return {command: extendCmd, args: key}; }
-        }
-        return {command: "null", passEvent: hashId == 0 || hashId == 4};
-    }
-
-}).call(IncrementalSearchKeyboardHandler.prototype);
-
-
-exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;
-
-});
-
-define("ace/incremental_search",["require","exports","module","ace/lib/oop","ace/range","ace/search","ace/search_highlight","ace/commands/incremental_search_commands","ace/lib/dom","ace/commands/command_manager","ace/editor","ace/config"], function(require, exports, module) {
-"use strict";
-
-var oop = require("./lib/oop");
-var Range = require("./range").Range;
-var Search = require("./search").Search;
-var SearchHighlight = require("./search_highlight").SearchHighlight;
-var iSearchCommandModule = require("./commands/incremental_search_commands");
-var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler;
-function IncrementalSearch() {
-    this.$options = {wrap: false, skipCurrent: false};
-    this.$keyboardHandler = new ISearchKbd(this);
-}
-
-oop.inherits(IncrementalSearch, Search);
-
-function isRegExp(obj) {
-    return obj instanceof RegExp;
-}
-
-function regExpToObject(re) {
-    var string = String(re),
-        start = string.indexOf('/'),
-        flagStart = string.lastIndexOf('/');
-    return {
-        expression: string.slice(start+1, flagStart),
-        flags: string.slice(flagStart+1)
-    }
-}
-
-function stringToRegExp(string, flags) {
-    try {
-        return new RegExp(string, flags);
-    } catch (e) { return string; }
-}
-
-function objectToRegExp(obj) {
-    return stringToRegExp(obj.expression, obj.flags);
-}
-
-;(function() {
-
-    this.activate = function(ed, backwards) {
-        this.$editor = ed;
-        this.$startPos = this.$currentPos = ed.getCursorPosition();
-        this.$options.needle = '';
-        this.$options.backwards = backwards;
-        ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);
-        this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this);
-        this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
-        this.selectionFix(ed);
-        this.statusMessage(true);
-    }
-
-    this.deactivate = function(reset) {
-        this.cancelSearch(reset);
-        var ed = this.$editor;
-        ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
-        if (this.$mousedownHandler) {
-            ed.removeEventListener('mousedown', this.$mousedownHandler);
-            delete this.$mousedownHandler;
-        }
-        ed.onPaste = this.$originalEditorOnPaste;
-        this.message('');
-    }
-
-    this.selectionFix = function(editor) {
-        if (editor.selection.isEmpty() && !editor.session.$emacsMark) {
-            editor.clearSelection();
-        }
-    }
-
-    this.highlight = function(regexp) {
-        var sess = this.$editor.session,
-            hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker(
-                new SearchHighlight(null, "ace_isearch-result", "text"));
-        hl.setRegexp(regexp);
-        sess._emit("changeBackMarker"); // force highlight layer redraw
-    }
-
-    this.cancelSearch = function(reset) {
-        var e = this.$editor;
-        this.$prevNeedle = this.$options.needle;
-        this.$options.needle = '';
-        if (reset) {
-            e.moveCursorToPosition(this.$startPos);
-            this.$currentPos = this.$startPos;
-        } else {
-            e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false);
-        }
-        this.highlight(null);
-        return Range.fromPoints(this.$currentPos, this.$currentPos);
-    }
-
-    this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) {
-        if (!this.$editor) return null;
-        var options = this.$options;
-        if (needleUpdateFunc) {
-            options.needle = needleUpdateFunc.call(this, options.needle || '') || '';
-        }
-        if (options.needle.length === 0) {
-            this.statusMessage(true);
-            return this.cancelSearch(true);
-        };
-        options.start = this.$currentPos;
-        var session = this.$editor.session,
-            found = this.find(session),
-            shouldSelect = this.$editor.emacsMark ?
-                !!this.$editor.emacsMark() : !this.$editor.selection.isEmpty();
-        if (found) {
-            if (options.backwards) found = Range.fromPoints(found.end, found.start);
-            this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end));
-            if (moveToNext) this.$currentPos = found.end;
-            this.highlight(options.re)
-        }
-
-        this.statusMessage(found);
-
-        return found;
-    }
-
-    this.addString = function(s) {
-        return this.highlightAndFindWithNeedle(false, function(needle) {
-            if (!isRegExp(needle))
-              return needle + s;
-            var reObj = regExpToObject(needle);
-            reObj.expression += s;
-            return objectToRegExp(reObj);
-        });
-    }
-
-    this.removeChar = function(c) {
-        return this.highlightAndFindWithNeedle(false, function(needle) {
-            if (!isRegExp(needle))
-              return needle.substring(0, needle.length-1);
-            var reObj = regExpToObject(needle);
-            reObj.expression = reObj.expression.substring(0, reObj.expression.length-1);
-            return objectToRegExp(reObj);
-        });
-    }
-
-    this.next = function(options) {
-        options = options || {};
-        this.$options.backwards = !!options.backwards;
-        this.$currentPos = this.$editor.getCursorPosition();
-        return this.highlightAndFindWithNeedle(true, function(needle) {
-            return options.useCurrentOrPrevSearch && needle.length === 0 ?
-                this.$prevNeedle || '' : needle;
-        });
-    }
-
-    this.onMouseDown = function(evt) {
-        this.deactivate();
-        return true;
-    }
-
-    this.onPaste = function(text) {
-        this.addString(text);
-    }
-
-    this.convertNeedleToRegExp = function() {
-        return this.highlightAndFindWithNeedle(false, function(needle) {
-            return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig');
-        });
-    }
-
-    this.convertNeedleToString = function() {
-        return this.highlightAndFindWithNeedle(false, function(needle) {
-            return isRegExp(needle) ? regExpToObject(needle).expression : needle;
-        });
-    }
-
-    this.statusMessage = function(found) {
-        var options = this.$options, msg = '';
-        msg += options.backwards ? 'reverse-' : '';
-        msg += 'isearch: ' + options.needle;
-        msg += found ? '' : ' (not found)';
-        this.message(msg);
-    }
-
-    this.message = function(msg) {
-        if (this.$editor.showCommandLine) {
-            this.$editor.showCommandLine(msg);
-            this.$editor.focus();
-        } else {
-            console.log(msg);
-        }
-    }
-
-}).call(IncrementalSearch.prototype);
-
-
-exports.IncrementalSearch = IncrementalSearch;
-
-var dom = require('./lib/dom');
-dom.importCssString && dom.importCssString("\
-.ace_marker-layer .ace_isearch-result {\
-  position: absolute;\
-  z-index: 6;\
-  -moz-box-sizing: border-box;\
-  -webkit-box-sizing: border-box;\
-  box-sizing: border-box;\
-}\
-div.ace_isearch-result {\
-  border-radius: 4px;\
-  background-color: rgba(255, 200, 0, 0.5);\
-  box-shadow: 0 0 4px rgb(255, 200, 0);\
-}\
-.ace_dark div.ace_isearch-result {\
-  background-color: rgb(100, 110, 160);\
-  box-shadow: 0 0 4px rgb(80, 90, 140);\
-}", "incremental-search-highlighting");
-var commands = require("./commands/command_manager");
-(function() {
-    this.setupIncrementalSearch = function(editor, val) {
-        if (this.usesIncrementalSearch == val) return;
-        this.usesIncrementalSearch = val;
-        var iSearchCommands = iSearchCommandModule.iSearchStartCommands;
-        var method = val ? 'addCommands' : 'removeCommands';
-        this[method](iSearchCommands);
-    };
-}).call(commands.CommandManager.prototype);
-var Editor = require("./editor").Editor;
-require("./config").defineOptions(Editor.prototype, "editor", {
-    useIncrementalSearch: {
-        set: function(val) {
-            this.keyBinding.$handlers.forEach(function(handler) {
-                if (handler.setupIncrementalSearch) {
-                    handler.setupIncrementalSearch(this, val);
-                }
-            });
-            this._emit('incrementalSearchSettingChanged', {isEnabled: val});
-        }
-    }
-});
-
-});
-
-define("ace/keyboard/emacs",["require","exports","module","ace/lib/dom","ace/incremental_search","ace/commands/incremental_search_commands","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
-"use strict";
-
-var dom = require("../lib/dom");
-require("../incremental_search");
-var iSearchCommandModule = require("../commands/incremental_search_commands");
-
-
-var screenToTextBlockCoordinates = function(x, y) {
-    var canvasPos = this.scroller.getBoundingClientRect();
-
-    var col = Math.floor(
-        (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
-    );
-    var row = Math.floor(
-        (y + this.scrollTop - canvasPos.top) / this.lineHeight
-    );
-
-    return this.session.screenToDocumentPosition(row, col);
-};
-
-var HashHandler = require("./hash_handler").HashHandler;
-exports.handler = new HashHandler();
-
-exports.handler.isEmacs = true;
-exports.handler.$id = "ace/keyboard/emacs";
-
-var initialized = false;
-var $formerLongWords;
-var $formerLineStart;
-
-exports.handler.attach = function(editor) {
-    if (!initialized) {
-        initialized = true;
-        dom.importCssString('\
-            .emacs-mode .ace_cursor{\
-                border: 1px rgba(50,250,50,0.8) solid!important;\
-                -moz-box-sizing: border-box!important;\
-                -webkit-box-sizing: border-box!important;\
-                box-sizing: border-box!important;\
-                background-color: rgba(0,250,0,0.9);\
-                opacity: 0.5;\
-            }\
-            .emacs-mode .ace_hidden-cursors .ace_cursor{\
-                opacity: 1;\
-                background-color: transparent;\
-            }\
-            .emacs-mode .ace_overwrite-cursors .ace_cursor {\
-                opacity: 1;\
-                background-color: transparent;\
-                border-width: 0 0 2px 2px !important;\
-            }\
-            .emacs-mode .ace_text-layer {\
-                z-index: 4\
-            }\
-            .emacs-mode .ace_cursor-layer {\
-                z-index: 2\
-            }', 'emacsMode'
-        );
-    }
-    $formerLongWords = editor.session.$selectLongWords;
-    editor.session.$selectLongWords = true;
-    $formerLineStart = editor.session.$useEmacsStyleLineStart;
-    editor.session.$useEmacsStyleLineStart = true;
-
-    editor.session.$emacsMark = null; // the active mark
-    editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];
-
-    editor.emacsMark = function() {
-        return this.session.$emacsMark;
-    };
-
-    editor.setEmacsMark = function(p) {
-        this.session.$emacsMark = p;
-    };
-
-    editor.pushEmacsMark = function(p, activate) {
-        var prevMark = this.session.$emacsMark;
-        if (prevMark)
-            this.session.$emacsMarkRing.push(prevMark);
-        if (!p || activate) this.setEmacsMark(p);
-        else this.session.$emacsMarkRing.push(p);
-    };
-
-    editor.popEmacsMark = function() {
-        var mark = this.emacsMark();
-        if (mark) { this.setEmacsMark(null); return mark; }
-        return this.session.$emacsMarkRing.pop();
-    };
-
-    editor.getLastEmacsMark = function(p) {
-        return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
-    };
-
-    editor.emacsMarkForSelection = function(replacement) {
-        var sel = this.selection,
-            multiRangeLength = this.multiSelect ?
-                this.multiSelect.getAllRanges().length : 1,
-            selIndex = sel.index || 0,
-            markRing = this.session.$emacsMarkRing,
-            markIndex = markRing.length - (multiRangeLength - selIndex),
-            lastMark = markRing[markIndex] || sel.anchor;
-        if (replacement) {
-            markRing.splice(markIndex, 1,
-                "row" in replacement && "column" in replacement ?
-                    replacement : undefined);
-        }
-        return lastMark;
-    }
-
-    editor.on("click", $resetMarkMode);
-    editor.on("changeSession", $kbSessionChange);
-    editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
-    editor.setStyle("emacs-mode");
-    editor.commands.addCommands(commands);
-    exports.handler.platform = editor.commands.platform;
-    editor.$emacsModeHandler = this;
-    editor.addEventListener('copy', this.onCopy);
-    editor.addEventListener('paste', this.onPaste);
-};
-
-exports.handler.detach = function(editor) {
-    delete editor.renderer.screenToTextCoordinates;
-    editor.session.$selectLongWords = $formerLongWords;
-    editor.session.$useEmacsStyleLineStart = $formerLineStart;
-    editor.removeEventListener("click", $resetMarkMode);
-    editor.removeEventListener("changeSession", $kbSessionChange);
-    editor.unsetStyle("emacs-mode");
-    editor.commands.removeCommands(commands);
-    editor.removeEventListener('copy', this.onCopy);
-    editor.removeEventListener('paste', this.onPaste);
-    editor.$emacsModeHandler = null;
-};
-
-var $kbSessionChange = function(e) {
-    if (e.oldSession) {
-        e.oldSession.$selectLongWords = $formerLongWords;
-        e.oldSession.$useEmacsStyleLineStart = $formerLineStart;
-    }
-
-    $formerLongWords = e.session.$selectLongWords;
-    e.session.$selectLongWords = true;
-    $formerLineStart = e.session.$useEmacsStyleLineStart;
-    e.session.$useEmacsStyleLineStart = true;
-
-    if (!e.session.hasOwnProperty('$emacsMark'))
-        e.session.$emacsMark = null;
-    if (!e.session.hasOwnProperty('$emacsMarkRing'))
-        e.session.$emacsMarkRing = [];
-};
-
-var $resetMarkMode = function(e) {
-    e.editor.session.$emacsMark = null;
-};
-
-var keys = require("../lib/keys").KEY_MODS;
-var eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"};
-var combinations = ["C-S-M-CMD",
-                    "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
-                    "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
-                    "CMD", "M", "S", "C"];
-combinations.forEach(function(c) {
-    var hashId = 0;
-    c.split("-").forEach(function(c) {
-        hashId = hashId | keys[eMods[c]];
-    });
-    eMods[hashId] = c.toLowerCase() + "-";
-});
-
-exports.handler.onCopy = function(e, editor) {
-    if (editor.$handlesEmacsOnCopy) return;
-    editor.$handlesEmacsOnCopy = true;
-    exports.handler.commands.killRingSave.exec(editor);
-    editor.$handlesEmacsOnCopy = false;
-};
-
-exports.handler.onPaste = function(e, editor) {
-    editor.pushEmacsMark(editor.getCursorPosition());
-};
-
-exports.handler.bindKey = function(key, command) {
-    if (typeof key == "object")
-        key = key[this.platform];
-    if (!key)
-        return;
-
-    var ckb = this.commandKeyBinding;
-    key.split("|").forEach(function(keyPart) {
-        keyPart = keyPart.toLowerCase();
-        ckb[keyPart] = command;
-        var keyParts = keyPart.split(" ").slice(0,-1);
-        keyParts.reduce(function(keyMapKeys, keyPart, i) {
-            var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : '';
-            return keyMapKeys.concat([prefix + keyPart]);
-        }, []).forEach(function(keyPart) {
-            if (!ckb[keyPart]) ckb[keyPart] = "null";
-        });
-    }, this);
-};
-
-exports.handler.getStatusText = function(editor, data) {
-  var str = "";
-  if (data.count)
-    str += data.count;
-  if (data.keyChain)
-    str += " " + data.keyChain
-  return str;
-};
-
-exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
-    if (keyCode === -1) return undefined;
-
-    var editor = data.editor;
-    editor._signal("changeStatus");
-    if (hashId == -1) {
-        editor.pushEmacsMark();
-        if (data.count) {
-            var str = new Array(data.count + 1).join(key);
-            data.count = null;
-            return {command: "insertstring", args: str};
-        }
-    }
-
-    var modifier = eMods[hashId];
-    if (modifier == "c-" || data.count) {
-        var count = parseInt(key[key.length - 1]);
-        if (typeof count === 'number' && !isNaN(count)) {
-            data.count = Math.max(data.count, 0) || 0;
-            data.count = 10 * data.count + count;
-            return {command: "null"};
-        }
-    }
-    if (modifier) key = modifier + key;
-    if (data.keyChain) key = data.keyChain += " " + key;
-    var command = this.commandKeyBinding[key];
-    data.keyChain = command == "null" ? key : "";
-    if (!command) return undefined;
-    if (command === "null") return {command: "null"};
-
-    if (command === "universalArgument") {
-        data.count = -4;
-        return {command: "null"};
-    }
-    var args;
-    if (typeof command !== "string") {
-        args = command.args;
-        if (command.command) command = command.command;
-        if (command === "goorselect") {
-            command = editor.emacsMark() ? args[1] : args[0];
-            args = null;
-        }
-    }
-
-    if (typeof command === "string") {
-        if (command === "insertstring" ||
-            command === "splitline" ||
-            command === "togglecomment") {
-            editor.pushEmacsMark();
-        }
-        command = this.commands[command] || editor.commands.commands[command];
-        if (!command) return undefined;
-    }
-
-    if (!command.readOnly && !command.isYank)
-        data.lastCommand = null;
-
-    if (!command.readOnly && editor.emacsMark())
-        editor.setEmacsMark(null)
-        
-    if (data.count) {
-        var count = data.count;
-        data.count = 0;
-        if (!command || !command.handlesCount) {
-            return {
-                args: args,
-                command: {
-                    exec: function(editor, args) {
-                        for (var i = 0; i < count; i++)
-                            command.exec(editor, args);
-                    },
-                    multiSelectAction: command.multiSelectAction
-                }
-            };
-        } else {
-            if (!args) args = {};
-            if (typeof args === 'object') args.count = count;
-        }
-    }
-
-    return {command: command, args: args};
-};
-
-exports.emacsKeys = {
-    "Up|C-p"      : {command: "goorselect", args: ["golineup","selectup"]},
-    "Down|C-n"    : {command: "goorselect", args: ["golinedown","selectdown"]},
-    "Left|C-b"    : {command: "goorselect", args: ["gotoleft","selectleft"]},
-    "Right|C-f"   : {command: "goorselect", args: ["gotoright","selectright"]},
-    "C-Left|M-b"  : {command: "goorselect", args: ["gotowordleft","selectwordleft"]},
-    "C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]},
-    "Home|C-a"    : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]},
-    "End|C-e"     : {command: "goorselect", args: ["gotolineend","selecttolineend"]},
-    "C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]},
-    "C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]},
-    "S-Up|S-C-p"      : "selectup",
-    "S-Down|S-C-n"    : "selectdown",
-    "S-Left|S-C-b"    : "selectleft",
-    "S-Right|S-C-f"   : "selectright",
-    "S-C-Left|S-M-b"  : "selectwordleft",
-    "S-C-Right|S-M-f" : "selectwordright",
-    "S-Home|S-C-a"    : "selecttolinestart",
-    "S-End|S-C-e"     : "selecttolineend",
-    "S-C-Home"        : "selecttostart",
-    "S-C-End"         : "selecttoend",
-
-    "C-l" : "recenterTopBottom",
-    "M-s" : "centerselection",
-    "M-g": "gotoline",
-    "C-x C-p": "selectall",
-    "C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
-    "C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]},
-    "PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
-    "PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]},
-    "S-C-Down": "selectpagedown",
-    "S-C-Up": "selectpageup",
-
-    "C-s": "iSearch",
-    "C-r": "iSearchBackwards",
-
-    "M-C-s": "findnext",
-    "M-C-r": "findprevious",
-    "S-M-5": "replace",
-    "Backspace": "backspace",
-    "Delete|C-d": "del",
-    "Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
-    "C-o": "splitline",
-
-    "M-d|C-Delete": {command: "killWord", args: "right"},
-    "C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
-    "C-k": "killLine",
-
-    "C-y|S-Delete": "yank",
-    "M-y": "yankRotate",
-    "C-g": "keyboardQuit",
-
-    "C-w|C-S-W": "killRegion",
-    "M-w": "killRingSave",
-    "C-Space": "setMark",
-    "C-x C-x": "exchangePointAndMark",
-
-    "C-t": "transposeletters",
-    "M-u": "touppercase",    // Doesn't work
-    "M-l": "tolowercase",
-    "M-/": "autocomplete",   // Doesn't work
-    "C-u": "universalArgument",
-
-    "M-;": "togglecomment",
-
-    "C-/|C-x u|S-C--|C-z": "undo",
-    "S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
-    "C-x r":  "selectRectangularRegion",
-    "M-x": {command: "focusCommandLine", args: "M-x "}
-};
-
-
-exports.handler.bindKeys(exports.emacsKeys);
-
-exports.handler.addCommands({
-    recenterTopBottom: function(editor) {
-        var renderer = editor.renderer;
-        var pos = renderer.$cursorLayer.getPixelPosition();
-        var h = renderer.$size.scrollerHeight - renderer.lineHeight;
-        var scrollTop = renderer.scrollTop;
-        if (Math.abs(pos.top - scrollTop) < 2) {
-            scrollTop = pos.top - h;
-        } else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
-            scrollTop = pos.top;
-        } else {
-            scrollTop = pos.top - h * 0.5;
-        }
-        editor.session.setScrollTop(scrollTop);
-    },
-    selectRectangularRegion:  function(editor) {
-        editor.multiSelect.toggleBlockSelection();
-    },
-    setMark:  {
-        exec: function(editor, args) {
-
-            if (args && args.count) {
-                if (editor.inMultiSelectMode) editor.forEachSelection(moveToMark);
-                else moveToMark();
-                moveToMark();
-                return;
-            }
-
-            var mark = editor.emacsMark(),
-                ranges = editor.selection.getAllRanges(),
-                rangePositions = ranges.map(function(r) { return {row: r.start.row, column: r.start.column}; }),
-                transientMarkModeActive = true,
-                hasNoSelection = ranges.every(function(range) { return range.isEmpty(); });
-            if (transientMarkModeActive && (mark || !hasNoSelection)) {
-                if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)})
-                else editor.clearSelection();
-                if (mark) editor.pushEmacsMark(null);
-                return;
-            }
-
-            if (!mark) {
-                rangePositions.forEach(function(pos) { editor.pushEmacsMark(pos); });
-                editor.setEmacsMark(rangePositions[rangePositions.length-1]);
-                return;
-            }
-
-            function moveToMark() {
-                var mark = editor.popEmacsMark();
-                mark && editor.moveCursorToPosition(mark);
-            }
-
-        },
-        readOnly: true,
-        handlesCount: true
-    },
-    exchangePointAndMark: {
-        exec: function exchangePointAndMark$exec(editor, args) {
-            var sel = editor.selection;
-            if (!args.count && !sel.isEmpty()) { // just invert selection
-                sel.setSelectionRange(sel.getRange(), !sel.isBackwards());
-                return;
-            }
-
-            if (args.count) { // replace mark and point
-                var pos = {row: sel.lead.row, column: sel.lead.column};
-                sel.clearSelection();
-                sel.moveCursorToPosition(editor.emacsMarkForSelection(pos));
-            } else { // create selection to last mark
-                sel.selectToPosition(editor.emacsMarkForSelection());
-            }
-        },
-        readOnly: true,
-        handlesCount: true,
-        multiSelectAction: "forEach"
-    },
-    killWord: {
-        exec: function(editor, dir) {
-            editor.clearSelection();
-            if (dir == "left")
-                editor.selection.selectWordLeft();
-            else
-                editor.selection.selectWordRight();
-
-            var range = editor.getSelectionRange();
-            var text = editor.session.getTextRange(range);
-            exports.killRing.add(text);
-
-            editor.session.remove(range);
-            editor.clearSelection();
-        },
-        multiSelectAction: "forEach"
-    },
-    killLine: function(editor) {
-        editor.pushEmacsMark(null);
-        var pos = editor.getCursorPosition();
-        if (pos.column === 0 &&
-            editor.session.doc.getLine(pos.row).length === 0) {
-            editor.selection.selectLine();
-        } else {
-            editor.clearSelection();
-            editor.selection.selectLineEnd();
-        }
-        var range = editor.getSelectionRange();
-        var text = editor.session.getTextRange(range);
-        exports.killRing.add(text);
-
-        editor.session.remove(range);
-        editor.clearSelection();
-    },
-    yank: function(editor) {
-        editor.onPaste(exports.killRing.get() || '');
-        editor.keyBinding.$data.lastCommand = "yank";
-    },
-    yankRotate: function(editor) {
-        if (editor.keyBinding.$data.lastCommand != "yank")
-            return;
-        editor.undo();
-        editor.session.$emacsMarkRing.pop(); // also undo recording mark
-        editor.onPaste(exports.killRing.rotate());
-        editor.keyBinding.$data.lastCommand = "yank";
-    },
-    killRegion: {
-        exec: function(editor) {
-            exports.killRing.add(editor.getCopyText());
-            editor.commands.byName.cut.exec(editor);
-        },
-        readOnly: true,
-        multiSelectAction: "forEach"
-    },
-    killRingSave: {
-        exec: function(editor) {
-
-            editor.$handlesEmacsOnCopy = true;
-            var marks = editor.session.$emacsMarkRing.slice(),
-                deselectedMarks = [];
-            exports.killRing.add(editor.getCopyText());
-
-            setTimeout(function() {
-                function deselect() {
-                    var sel = editor.selection, range = sel.getRange(),
-                        pos = sel.isBackwards() ? range.end : range.start;
-                    deselectedMarks.push({row: pos.row, column: pos.column});
-                    sel.clearSelection();
-                }
-                editor.$handlesEmacsOnCopy = false;
-                if (editor.inMultiSelectMode) editor.forEachSelection({exec: deselect});
-                else deselect();
-                editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse());
-            }, 0);
-        },
-        readOnly: true
-    },
-    keyboardQuit: function(editor) {
-        editor.selection.clearSelection();
-        editor.setEmacsMark(null);
-        editor.keyBinding.$data.count = null;
-    },
-    focusCommandLine: function(editor, arg) {
-        if (editor.showCommandLine)
-            editor.showCommandLine(arg);
-    }
-});
-
-exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
-
-var commands = exports.handler.commands;
-commands.yank.isYank = true;
-commands.yankRotate.isYank = true;
-
-exports.killRing = {
-    $data: [],
-    add: function(str) {
-        str && this.$data.push(str);
-        if (this.$data.length > 30)
-            this.$data.shift();
-    },
-    get: function(n) {
-        n = n || 1;
-        return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n');
-    },
-    pop: function() {
-        if (this.$data.length > 1)
-            this.$data.pop();
-        return this.get();
-    },
-    rotate: function() {
-        this.$data.unshift(this.$data.pop());
-        return this.get();
-    }
-};
-
-});


Mime
View raw message