<commit_before>/*global CodeMirror*/
BN.addDecl('b-project-file-viewer')
    .instanceProp({
        /**
         * @private
         */
        _initCodeMirror: function () {
            /**
             * @type {CodeMirror}
             * @protected
             */
            this._codeMirror = CodeMirror.fromTextArea(this.elem('text')[0], {
                mode: this.params.mode,
                theme: 'solarized dark',
                readOnly: this.hasMod('w', 'true') ? false : 'nocursor',
                lineNumbers: true,
                styleActiveLine: true,
                matchBrackets: true
            });
        }
    })
    .onSetMod({
        js: {
            inited: function () {
                this._initCodeMirror();
            }
        }
    });<commit_msg>CodeMirror settings improved: Tabs as spaces, copy of readonly text<commit_after>/*global CodeMirror*/
BN.addDecl('b-project-file-viewer')
    .instanceProp({
        /**
         * @private
         */
        _initCodeMirror: function () {
            /**
             * @type {CodeMirror}
             * @protected
             */
            this._codeMirror = CodeMirror.fromTextArea(this.elem('text')[0], {
                mode: this.params.mode,
                theme: 'solarized dark',
                readOnly: !this.hasMod('w', 'true'),
                lineNumbers: true,
                styleActiveLine: true,
                matchBrackets: true,
                indentUnit: 4,
                extraKeys: {
                    Tab: function (cm) {
                        if (cm.doc.somethingSelected()) {
                            return CodeMirror.Pass;
                        }
                        var spacesPerTab = cm.getOption('indentUnit'),
                            spacesToInsert = spacesPerTab - (cm.doc.getCursor('start').ch % spacesPerTab),
                            spaces = (new Array(spacesToInsert + 1)).join(' ');
                        cm.replaceSelection(spaces, 'end', '+input');
                    }
                }
            });
        }
    })
    .onSetMod({
        js: {
            inited: function () {
                this._initCodeMirror();
            }
        }
    });
{'fraction_non_alphanumeric': 0.12196219621962197, 'fraction_numerical': 0.0018001800180018, 'mean_word_length': 1.1436837029893925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7316066', 'n_tokens_mistral': 601, 'n_tokens_neox': 555, 'n_words': 97}