<commit_before>import * as Actions from "./actions"
import { IDeltaRegionTracker } from "./DeltaRegionTracker"
import { Grid } from "./Grid"

export type Mode = "insert" | "normal"

const wcwidth = require("wcwidth") // tslint:disable-line no-var-requires

export interface IHighlight {
    bold?: boolean
    italic?: boolean
    reverse?: boolean
    underline?: boolean
    undercurl?: boolean

    foregroundColor?: string
    backgroundColor?: string
}

export interface IScreen {
    backgroundColor: string
    currentBackgroundColor: string
    currentForegroundColor: string
    cursorColumn: number
    cursorRow: number
    fontFamily: null | string
    fontHeightInPixels: number
    fontSize: null | string
    fontWidthInPixels: number
    foregroundColor: string
    height: number
    mode: string
    width: number
    dispatch(action: Actions.IAction): void
    getCell(x: number, y: number): ICell
    getScrollRegion(): IScrollRegion
}

export interface ICell {
    character: string

    /**
     * Specify the width of the character. Some Unicode characters will take up multiple
     * cells, like `한`, which needs to be accounted for in rendering.
     */
    characterWidth: number

    foregroundColor?: string
    backgroundColor?: string
}

export interface IPixelPosition {
    x: number
    y: number
}

export interface IPosition {
    row: number
    column: number
}

export interface IScrollRegion {
    top: number
    bottom: number
    left: number
    right: number
}

export class NeovimScreen implements IScreen {
    private _backgroundColor: string = "#000000"
    private _currentHighlight: IHighlight = {}
    private _cursorColumn: number = 0
    private _cursorRow: number = 0
    private _deltaTracker: IDeltaRegionTracker
    private _fontFamily: null | string = null
    private _fontHeightInPixels: number
    private _fontSize: null | string = null
    private _fontWidthInPixels: number
    private _foregroundColor: string = "#00FF00"
    private _grid: Grid<ICell> = new Grid<ICell>()
    private _height: number = 40
    private _mode: Mode = "normal"
    private _scrollRegion: IScrollRegion
    private _width: number = 80

    constructor(deltaTracker: IDeltaRegionTracker) {
        this._deltaTracker = deltaTracker
    }

    public get width(): number {
        return this._width
    }

    public get height(): number {
        return this._height
    }<commit_msg>Fix green flash of text on startup (#611)<commit_after>import * as Actions from "./actions"
import { IDeltaRegionTracker } from "./DeltaRegionTracker"
import { Grid } from "./Grid"

export type Mode = "insert" | "normal"

const wcwidth = require("wcwidth") // tslint:disable-line no-var-requires

export interface IHighlight {
    bold?: boolean
    italic?: boolean
    reverse?: boolean
    underline?: boolean
    undercurl?: boolean

    foregroundColor?: string
    backgroundColor?: string
}

export interface IScreen {
    backgroundColor: string
    currentBackgroundColor: string
    currentForegroundColor: string
    cursorColumn: number
    cursorRow: number
    fontFamily: null | string
    fontHeightInPixels: number
    fontSize: null | string
    fontWidthInPixels: number
    foregroundColor: string
    height: number
    mode: string
    width: number
    dispatch(action: Actions.IAction): void
    getCell(x: number, y: number): ICell
    getScrollRegion(): IScrollRegion
}

export interface ICell {
    character: string

    /**
     * Specify the width of the character. Some Unicode characters will take up multiple
     * cells, like `한`, which needs to be accounted for in rendering.
     */
    characterWidth: number

    foregroundColor?: string
    backgroundColor?: string
}

export interface IPixelPosition {
    x: number
    y: number
}

export interface IPosition {
    row: number
    column: number
}

export interface IScrollRegion {
    top: number
    bottom: number
    left: number
    right: number
}

export class NeovimScreen implements IScreen {
    private _backgroundColor: string = "#000000"
    private _currentHighlight: IHighlight = {}
    private _cursorColumn: number = 0
    private _cursorRow: number = 0
    private _deltaTracker: IDeltaRegionTracker
    private _fontFamily: null | string = null
    private _fontHeightInPixels: number
    private _fontSize: null | string = null
    private _fontWidthInPixels: number
    private _foregroundColor: string = "#000000"
    private _grid: Grid<ICell> = new Grid<ICell>()
    private _height: number = 40
    private _mode: Mode = "normal"
    private _scrollRegion: IScrollRegion
    private _width: number = 80

    constructor(deltaTracker: IDeltaRegionTracker) {
        this._deltaTracker = deltaTracker
    }

    public get width(): number {
        return this._width
    }

    public get height(): number {
        return this._height
    }
{'fraction_non_alphanumeric': 0.07552189930413426, 'fraction_numerical': 0.00757265656979124, 'mean_word_length': 3.264397905759162, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '770830', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1305, 'n_words': 447}