<commit_before>import events = require('events');
import Char = require('./Char');
import Cursor = require('./Cursor');
import React = require('react');
import i = require('./Interfaces');
import e = require('./Enums');
import _ = require('lodash');
import Utils = require("./Utils");

class Buffer extends events.EventEmitter {
    private storage: Array<Array<Char>> = [];
    public cursor: Cursor = new Cursor();
    public activeBuffer = 'standard';
    private attributes: i.Attributes = {color: e.Color.White, weight: e.Weight.Normal};
    private renderRow: Function;

    constructor() {
        super();

        this.renderRow = _.memoize((row: Array<Char>, index: number, cursorPosition: i.Position) => {
            var consecutive: Array<any> = [];
            var current = {attributes: <i.Attributes>null, text: ''};

            if (index == cursorPosition.row && this.cursor.getShow()) {
                var rowWithCursor: Char[] = [];

                for (var i = 0; i != row.length; ++i) {
                    var old = row[i];
                    if (old) {
                        rowWithCursor[i] = new Char(old.toString(), old.getAttributes());
                    }
                }
                var cursorAttributes = {'background-color': e.Color.White};

                if (rowWithCursor[cursorPosition.column]) {
                    var char = rowWithCursor[cursorPosition.column];
                    var newChar = new Char(char.toString(), _.merge(char.getAttributes(), cursorAttributes));
                } else {
                    newChar = new Char(' ', cursorAttributes);<commit_msg>Set cursor's background and foreground colors.<commit_after>import events = require('events');
import Char = require('./Char');
import Cursor = require('./Cursor');
import React = require('react');
import i = require('./Interfaces');
import e = require('./Enums');
import _ = require('lodash');
import Utils = require("./Utils");

class Buffer extends events.EventEmitter {
    private storage: Array<Array<Char>> = [];
    public cursor: Cursor = new Cursor();
    public activeBuffer = 'standard';
    private attributes: i.Attributes = {color: e.Color.White, weight: e.Weight.Normal};
    private renderRow: Function;

    constructor() {
        super();

        this.renderRow = _.memoize((row: Array<Char>, index: number, cursorPosition: i.Position) => {
            var consecutive: Array<any> = [];
            var current = {attributes: <i.Attributes>null, text: ''};

            if (index == cursorPosition.row && this.cursor.getShow()) {
                var rowWithCursor: Char[] = [];

                for (var i = 0; i != row.length; ++i) {
                    var old = row[i];
                    if (old) {
                        rowWithCursor[i] = new Char(old.toString(), old.getAttributes());
                    }
                }
                // TODO: change accordingly to the theme background color.
                var cursorAttributes = {'background-color': e.Color.White, color: e.Color.Black};

                if (rowWithCursor[cursorPosition.column]) {
                    var char = rowWithCursor[cursorPosition.column];
                    var newChar = new Char(char.toString(), _.merge(char.getAttributes(), cursorAttributes));
                } else {
                    newChar = new Char(' ', cursorAttributes);
{'fraction_non_alphanumeric': 0.14201183431952663, 'fraction_numerical': 0.000591715976331361, 'mean_word_length': 2.2108262108262107, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '7505912', 'n_tokens_mistral': 877, 'n_tokens_neox': 835, 'n_words': 230}