winptyCompat.js 1.03 KB
Newer Older
jose's avatar
jose committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
(function (addon) {
    if (typeof window !== 'undefined' && 'Terminal' in window) {
        addon(window.Terminal);
    }
    else if (typeof exports === 'object' && typeof module === 'object') {
        module.exports = addon(require('../../Terminal').Terminal);
    }
    else if (typeof define === 'function') {
        define(['../../xterm'], addon);
    }
})(function (Terminal) {
    Terminal.prototype.winptyCompatInit = function () {
        var _this = this;
        var isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0;
        if (!isWindows) {
            return;
        }
        this.on('lineFeed', function () {
            var line = _this.buffer.lines.get(_this.buffer.ybase + _this.buffer.y - 1);
            var lastChar = line[_this.cols - 1];
            if (lastChar[3] !== 32) {
                var nextLine = _this.buffer.lines.get(_this.buffer.ybase + _this.buffer.y);
                nextLine.isWrapped = true;
            }
        });
    };
});

//# sourceMappingURL=winptyCompat.js.map