<commit_before>define(function(require, exports, module) {
    "use strict";

    plugin.consumes = ["eventbus", "command", "config", "modes", "sandbox"];
    plugin.provides = ["editor"];
    return plugin;

    function plugin(options, imports, register) {
        var whitespace = require("ace/ext/whitespace");
        var font = require("./lib/font");

        var eventbus = imports.eventbus;
        var command = imports.command;
        var config = imports.config;
        var modes = imports.modes;
        var sandbox = imports.sandbox;

        var IDENT_REGEX = /[a-zA-Z0-9_$\-]+/;
        var PATH_REGEX = /[\/\.a-zA-Z0-9_$\-:]/;

        eventbus.declare("editorloaded");
        eventbus.declare("selectionchanged");
        eventbus.declare("sessionclicked"); // edit, session, event

        var editors = [];
        var activeEditor = null;

        var api = {
            hook: function() {
                eventbus.on("configchanged", function() {
                    setTimeout(api.updateConfiguration);
                });

                eventbus.on("switchsession", function(edit, session) {
                    api.setEditorConfiguration(edit);
                    api.setSessionConfiguration(session);
                });

                eventbus.on("filedeleted", function(path) {
                    editors.forEach(function(edit) {
                        if (edit.getSession().filename === path) {
                            zed.getService("session_manager").go("zed::start", edit);
                        }
                    });
                });
            },
            setEditorConfiguration: function(edit) {
                var session = edit.getSession();
                edit.setHighlightActiveLine(config.getPreference("highlightActiveLine", session));
                edit.setHighlightGutterLine(config.getPreference("highlightGutterLine", session));
                edit.setFontSize(config.getPreference("fontSize", session));
                edit.setShowPrintMargin(config.getPreference("showPrintMargin", session));
                edit.setPrintMarginColumn(config.getPreference("printMarginColumn", session));
                edit.setShowInvisibles(config.getPreference("showInvisibles", session));
                edit.setDisplayIndentGuides(config.getPreference("displayIndentGuides", session));
                edit.setOption("scrollPastEnd", config.getPreference("scrollPastEnd", session));
                edit.setAnimatedScroll(config.getPreference("animatedScroll", session));
                edit.setShowFoldWidgets(config.getPreference("showFoldWidgets", session));
                edit.setScrollSpeed(config.getPreference("scrollSpeed", session));
                edit.renderer.setShowGutter(config.getPreference("showGutter", session));
                edit.setHighlightSelectedWord(config.getPreference("highlightSelectedWord", session));
                edit.setBehavioursEnabled(config.getPreference("behaviorsEnabled", session)); // ( -> ()
                edit.setWrapBehavioursEnabled(config.getPreference("wrapBehaviorsEnabled", session)); // same as above but with selection
                var fontFamily = config.getPreference("fontFamily");
                if (font.isInstalled(fontFamily)) {
                    $(edit.container).css("font-family", config.getPreference("fontFamily"));
                } else {
                    eventbus.emit("sessionactivityfailed", session, "Invalid font: " + fontFamily);
                }

                if (config.getPreference("autoIndentOnPaste", session)) {
                    edit.on("paste", function(e) {
                        autoIndentOnPaste(edit, session, e);
                    });
                } else {
                    edit.removeAllListeners("paste");
                }
                edit.setKeyboardHandler({
                    vim: "ace/keyboard/vim",
                    emacs: "ace/keyboard/emacs",
                    zed: null
                }[config.getPreference("keybinding", session)]);
            },
            setSessionConfiguration: function(session) {
                session.setTabSize(config.getPreference("tabSize", session));
                session.setUseSoftTabs(config.getPreference("useSoftTabs", session));
                session.setUseWrapMode(config.getPreference("wordWrap", session));
                session.setWrapLimitRange(null, config.getPreference("wordWrapColumn", session));
            },
            updateConfiguration: function() {
                api.getEditors(true).forEach(function(edit) {
                    api.setEditorConfiguration(edit);
                });
                var sessions = zed.getService("session_manager").getSessions();
                _.each(sessions, function(session) {
                    api.setSessionConfiguration(session);
                });
            },
            // Automatically called after all plugins are instantiated
            init: function() {
                $("body").append("<div id='editor0' class='editor-single'>");
                $("body").append("<div id='editor1' class='editor-disabled'>");
                $("body").append("<div id='editor2' class='editor-disabled'>");

                ace.config.setDefaultValue("editor", "enableBasicAutocompletion", true);

                editors.push(ace.edit("editor0"));
                editors.push(ace.edit("editor1"));
                editors.push(ace.edit("editor2"));

                editors.forEach(function(editor) {
                    editor.setShowPrintMargin(false);
                    // Disable ACE's built-in theming
                    editor.setTheme({
                        cssClass: "_",<commit_msg>Fix bug where zed::start wouldn't be wordwrapped.<commit_after>define(function(require, exports, module) {
    "use strict";

    plugin.consumes = ["eventbus", "command", "config", "modes", "sandbox"];
    plugin.provides = ["editor"];
    return plugin;

    function plugin(options, imports, register) {
        var whitespace = require("ace/ext/whitespace");
        var font = require("./lib/font");

        var eventbus = imports.eventbus;
        var command = imports.command;
        var config = imports.config;
        var modes = imports.modes;
        var sandbox = imports.sandbox;

        var IDENT_REGEX = /[a-zA-Z0-9_$\-]+/;
        var PATH_REGEX = /[\/\.a-zA-Z0-9_$\-:]/;

        eventbus.declare("editorloaded");
        eventbus.declare("selectionchanged");
        eventbus.declare("sessionclicked"); // edit, session, event

        var editors = [];
        var activeEditor = null;

        var api = {
            hook: function() {
                eventbus.on("configchanged", function() {
                    setTimeout(api.updateConfiguration);
                });

                eventbus.on("switchsession", function(edit, session) {
                    api.setEditorConfiguration(edit);
                    api.setSessionConfiguration(session);
                });

                eventbus.on("filedeleted", function(path) {
                    editors.forEach(function(edit) {
                        if (edit.getSession().filename === path) {
                            zed.getService("session_manager").go("zed::start", edit);
                        }
                    });
                });
            },
            setEditorConfiguration: function(edit) {
                var session = edit.getSession();
                edit.setHighlightActiveLine(config.getPreference("highlightActiveLine", session));
                edit.setHighlightGutterLine(config.getPreference("highlightGutterLine", session));
                edit.setFontSize(config.getPreference("fontSize", session));
                edit.setShowPrintMargin(config.getPreference("showPrintMargin", session));
                edit.setPrintMarginColumn(config.getPreference("printMarginColumn", session));
                edit.setShowInvisibles(config.getPreference("showInvisibles", session));
                edit.setDisplayIndentGuides(config.getPreference("displayIndentGuides", session));
                edit.setOption("scrollPastEnd", config.getPreference("scrollPastEnd", session));
                edit.setAnimatedScroll(config.getPreference("animatedScroll", session));
                edit.setShowFoldWidgets(config.getPreference("showFoldWidgets", session));
                edit.setScrollSpeed(config.getPreference("scrollSpeed", session));
                edit.renderer.setShowGutter(config.getPreference("showGutter", session));
                edit.setHighlightSelectedWord(config.getPreference("highlightSelectedWord", session));
                edit.setBehavioursEnabled(config.getPreference("behaviorsEnabled", session)); // ( -> ()
                edit.setWrapBehavioursEnabled(config.getPreference("wrapBehaviorsEnabled", session)); // same as above but with selection
                var fontFamily = config.getPreference("fontFamily");
                if (font.isInstalled(fontFamily)) {
                    $(edit.container).css("font-family", config.getPreference("fontFamily"));
                } else {
                    eventbus.emit("sessionactivityfailed", session, "Invalid font: " + fontFamily);
                }

                if (config.getPreference("autoIndentOnPaste", session)) {
                    edit.on("paste", function(e) {
                        autoIndentOnPaste(edit, session, e);
                    });
                } else {
                    edit.removeAllListeners("paste");
                }
                edit.setKeyboardHandler({
                    vim: "ace/keyboard/vim",
                    emacs: "ace/keyboard/emacs",
                    zed: null
                }[config.getPreference("keybinding", session)]);
            },
            setSessionConfiguration: function(session) {
                session.setTabSize(config.getPreference("tabSize", session));
                session.setUseSoftTabs(config.getPreference("useSoftTabs", session));
                session.setUseWrapMode(config.getPreference("wordWrap", session));
                session.setWrapLimitRange(null, config.getPreference("wordWrapColumn", session));
            },
            updateConfiguration: function() {
                api.getEditors(true).forEach(function(edit) {
                    api.setEditorConfiguration(edit);
                });
                var session_manager = zed.getService("session_manager");
                var sessions = _.values(session_manager.getSessions()).concat(_.values(session_manager.specialDocs));
                _.each(sessions, function(session) {
                    api.setSessionConfiguration(session);
                });
            },
            // Automatically called after all plugins are instantiated
            init: function() {
                $("body").append("<div id='editor0' class='editor-single'>");
                $("body").append("<div id='editor1' class='editor-disabled'>");
                $("body").append("<div id='editor2' class='editor-disabled'>");

                ace.config.setDefaultValue("editor", "enableBasicAutocompletion", true);

                editors.push(ace.edit("editor0"));
                editors.push(ace.edit("editor1"));
                editors.push(ace.edit("editor2"));

                editors.forEach(function(editor) {
                    editor.setShowPrintMargin(false);
                    // Disable ACE's built-in theming
                    editor.setTheme({
                        cssClass: "_",
{'fraction_non_alphanumeric': 0.12494606954870999, 'fraction_numerical': 0.0017257744412805247, 'mean_word_length': 1.9763739085772984, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4285307', 'n_tokens_mistral': 2986, 'n_tokens_neox': 2777, 'n_words': 417}