<commit_before>'use strict';

var states = require('./lib/states');

/**
* Helpers
*/
var on       =  require('./lib/helpers/on')
  , off      =  require('./lib/helpers/off')
  , cancel   =  require('./lib/helpers/cancel')
  , inherits =  require('./lib/helpers/inherits')
  ;

/**
* Terminal
*/

var EventEmitter = require('events')
    .EventEmitter;

module.exports = Terminal;

function Terminal(cols, rows, opts) {
    if (!(this instanceof Terminal)) return new Terminal(cols, rows, opts);
    EventEmitter.call(this);

    this._options = opts || {};

    this.cols = cols || Terminal.geometry[0];
    this.rows = rows || Terminal.geometry[1];

    if (this._options.handler) {
        this.on('data', this._options.handler);
    }

    this.ybase = 0;
    this.ydisp = 0;
    this.x = 0;
    this.y = 0;
    this.cursorState = 0;
    this.cursorHidden = false;
    this.convertEol = false;
    this.state = states.normal;
    this.queue = '';
    this.scrollTop = 0;
    this.scrollBottom = this.rows - 1;

    // modes
    this.applicationKeypad = false;
    this.originMode = false;
    this.insertMode = false;
    this.wraparoundMode = false;
    this.normal = null;

    // charset
    this.charset = null;
    this.gcharset = null;
    this.glevel = 0;
    this.charsets = [null];

    // mouse properties
    this.decLocator;
    this.x10Mouse;
    this.vt200Mouse;
    this.vt300Mouse;
    this.normalMouse;
    this.mouseEvents;
    this.sendFocus;
    this.utfMouse;
    this.sgrMouse;
    this.urxvtMouse;

    // misc
    this.element;
    this.children;
    this.refreshStart;
    this.refreshEnd;
    this.savedX;
    this.savedY;
    this.savedCols;

    // stream
    this.readable = true;
    this.writable = true;

    this.defAttr = (257 << 9) | 256;
    this.curAttr = this.defAttr;

    this.params = [];
    this.currentParam = 0;
    this.prefix = '';
    this.postfix = '';

    this.lines = [];
    var i = this.rows;
    while (i--) {
        this.lines.push(this.blankLine());
    }

    this.tabs;
    this.setupStops();

    this.tabspace = this._options.tabspace || '  ';
}

inherits(Terminal, EventEmitter);

require('./lib/colors')(Terminal);
require('./lib/options')(Terminal);
require('./lib/focus')(Terminal);
require('./lib/open')(Terminal);
require('./lib/destroy')(Terminal);
require('./lib/refresh')(Terminal);
require('./lib/scroll')(Terminal);
require('./lib/scrollDisp')(Terminal);

require('./lib/write')(Terminal);

Terminal.prototype.keyDown = function(ev) {
    var key;

    switch (ev.keyCode) {
        // backspace
    case 8:
        if (ev.shiftKey) {
            key = '\x08'; // ^H
            break;
        }
        key = '\x7f'; // ^?
        break;
        // tab
    case 9:<commit_msg>disabling scrollDisp<commit_after>'use strict';

var states = require('./lib/states');

/**
* Helpers
*/
var on       =  require('./lib/helpers/on')
  , off      =  require('./lib/helpers/off')
  , cancel   =  require('./lib/helpers/cancel')
  , inherits =  require('./lib/helpers/inherits')
  ;

/**
* Terminal
*/

var EventEmitter = require('events')
    .EventEmitter;

module.exports = Terminal;

function Terminal(cols, rows, opts) {
    if (!(this instanceof Terminal)) return new Terminal(cols, rows, opts);
    EventEmitter.call(this);

    this._options = opts || {};

    this.cols = cols || Terminal.geometry[0];
    this.rows = rows || Terminal.geometry[1];

    if (this._options.handler) {
        this.on('data', this._options.handler);
    }

    this.ybase = 0;
    this.ydisp = 0;
    this.x = 0;
    this.y = 0;
    this.cursorState = 0;
    this.cursorHidden = false;
    this.convertEol = false;
    this.state = states.normal;
    this.queue = '';
    this.scrollTop = 0;
    this.scrollBottom = this.rows - 1;

    // modes
    this.applicationKeypad = false;
    this.originMode = false;
    this.insertMode = false;
    this.wraparoundMode = false;
    this.normal = null;

    // charset
    this.charset = null;
    this.gcharset = null;
    this.glevel = 0;
    this.charsets = [null];

    // mouse properties
    this.decLocator;
    this.x10Mouse;
    this.vt200Mouse;
    this.vt300Mouse;
    this.normalMouse;
    this.mouseEvents;
    this.sendFocus;
    this.utfMouse;
    this.sgrMouse;
    this.urxvtMouse;

    // misc
    this.element;
    this.children;
    this.refreshStart;
    this.refreshEnd;
    this.savedX;
    this.savedY;
    this.savedCols;

    // stream
    this.readable = true;
    this.writable = true;

    this.defAttr = (257 << 9) | 256;
    this.curAttr = this.defAttr;

    this.params = [];
    this.currentParam = 0;
    this.prefix = '';
    this.postfix = '';

    this.lines = [];
    var i = this.rows;
    while (i--) {
        this.lines.push(this.blankLine());
    }

    this.tabs;
    this.setupStops();

    this.tabspace = this._options.tabspace || '  ';
}

inherits(Terminal, EventEmitter);

require('./lib/colors')(Terminal);
require('./lib/options')(Terminal);
require('./lib/focus')(Terminal);
require('./lib/open')(Terminal);
require('./lib/destroy')(Terminal);
require('./lib/refresh')(Terminal);

// used by write, but most likely can be removed
require('./lib/scroll')(Terminal);

require('./lib/write')(Terminal);

Terminal.prototype.keyDown = function(ev) {
    var key;

    switch (ev.keyCode) {
        // backspace
    case 8:
        if (ev.shiftKey) {
            key = '\x08'; // ^H
            break;
        }
        key = '\x7f'; // ^?
        break;
        // tab
    case 9:
{'fraction_non_alphanumeric': 0.16304741223307997, 'fraction_numerical': 0.011219688744118711, 'mean_word_length': 2.3476680799515446, 'pattern_counts': {'":': 0, '<': 7, '<?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': '428147', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1854, 'n_words': 346}