Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xterm

Package Overview
Dependencies
Maintainers
2
Versions
1092
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xterm - npm Package Compare versions

Comparing version 3.14.0-beta1 to 3.14.0-beta10

lib/core/buffer/BufferLine.d.ts

26

dist/addons/search/search.js

@@ -14,7 +14,6 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.search = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

SearchHelper.prototype.findNext = function (term, searchOptions) {
var selectionManager = this._terminal._core.selectionManager;
var incremental = searchOptions.incremental;
var result;
if (!term || term.length === 0) {
selectionManager.clearSelection();
this._terminal.clearSelection();
return false;

@@ -24,7 +23,6 @@ }

var startRow = this._terminal._core.buffer.ydisp;
if (selectionManager.selectionEnd) {
if (this._terminal.getSelection().length !== 0) {
startRow = incremental ? selectionManager.selectionStart[1] : selectionManager.selectionEnd[1];
startCol = incremental ? selectionManager.selectionStart[0] : selectionManager.selectionEnd[0];
}
if (this._terminal.hasSelection()) {
var currentSelection = this._terminal.getSelectionPosition();
startRow = incremental ? currentSelection.startRow : currentSelection.endRow;
startCol = incremental ? currentSelection.startColumn : currentSelection.endColumn;
}

@@ -58,6 +56,5 @@ this._initLinesCache();

SearchHelper.prototype.findPrevious = function (term, searchOptions) {
var selectionManager = this._terminal._core.selectionManager;
var result;
if (!term || term.length === 0) {
selectionManager.clearSelection();
this._terminal.clearSelection();
return false;

@@ -68,7 +65,6 @@ }

var startCol = this._terminal.cols;
if (selectionManager.selectionStart) {
if (this._terminal.getSelection().length !== 0) {
startRow = selectionManager.selectionStart[1];
startCol = selectionManager.selectionStart[0];
}
if (this._terminal.hasSelection()) {
var currentSelection = this._terminal.getSelectionPosition();
startRow = currentSelection.startRow;
startCol = currentSelection.startColumn;
}

@@ -229,3 +225,3 @@ this._initLinesCache();

}
this._terminal._core.selectionManager.setSelection(result.col, result.row, result.term.length);
this._terminal.select(result.col, result.row, result.term.length);
this._terminal.scrollLines(result.row - this._terminal._core.buffer.ydisp);

@@ -232,0 +228,0 @@ return true;

import { Terminal } from 'xterm';
export interface ITerminalCore {
buffer: any;
selectionManager: any;
}

@@ -6,0 +5,0 @@ export interface ISearchAddonTerminal extends Terminal {

@@ -13,7 +13,6 @@ "use strict";

SearchHelper.prototype.findNext = function (term, searchOptions) {
var selectionManager = this._terminal._core.selectionManager;
var incremental = searchOptions.incremental;
var result;
if (!term || term.length === 0) {
selectionManager.clearSelection();
this._terminal.clearSelection();
return false;

@@ -23,7 +22,6 @@ }

var startRow = this._terminal._core.buffer.ydisp;
if (selectionManager.selectionEnd) {
if (this._terminal.getSelection().length !== 0) {
startRow = incremental ? selectionManager.selectionStart[1] : selectionManager.selectionEnd[1];
startCol = incremental ? selectionManager.selectionStart[0] : selectionManager.selectionEnd[0];
}
if (this._terminal.hasSelection()) {
var currentSelection = this._terminal.getSelectionPosition();
startRow = incremental ? currentSelection.startRow : currentSelection.endRow;
startCol = incremental ? currentSelection.startColumn : currentSelection.endColumn;
}

@@ -57,6 +55,5 @@ this._initLinesCache();

SearchHelper.prototype.findPrevious = function (term, searchOptions) {
var selectionManager = this._terminal._core.selectionManager;
var result;
if (!term || term.length === 0) {
selectionManager.clearSelection();
this._terminal.clearSelection();
return false;

@@ -67,7 +64,6 @@ }

var startCol = this._terminal.cols;
if (selectionManager.selectionStart) {
if (this._terminal.getSelection().length !== 0) {
startRow = selectionManager.selectionStart[1];
startCol = selectionManager.selectionStart[0];
}
if (this._terminal.hasSelection()) {
var currentSelection = this._terminal.getSelectionPosition();
startRow = currentSelection.startRow;
startCol = currentSelection.startColumn;
}

@@ -228,3 +224,3 @@ this._initLinesCache();

}
this._terminal._core.selectionManager.setSelection(result.col, result.row, result.term.length);
this._terminal.select(result.col, result.row, result.term.length);
this._terminal.scrollLines(result.row - this._terminal._core.buffer.ydisp);

@@ -231,0 +227,0 @@ return true;

@@ -17,20 +17,7 @@ "use strict";

var CircularList_1 = require("./common/CircularList");
var BufferLine_1 = require("./BufferLine");
var BufferLine_1 = require("./core/buffer/BufferLine");
var BufferReflow_1 = require("./BufferReflow");
var Types_1 = require("./renderer/atlas/Types");
var EventEmitter2_1 = require("./common/EventEmitter2");
var Lifecycle_1 = require("../lib/common/Lifecycle");
exports.DEFAULT_ATTR = (0 << 18) | (Types_1.DEFAULT_COLOR << 9) | (256 << 0);
exports.DEFAULT_ATTR_DATA = new BufferLine_1.AttributeData();
exports.CHAR_DATA_ATTR_INDEX = 0;
exports.CHAR_DATA_CHAR_INDEX = 1;
exports.CHAR_DATA_WIDTH_INDEX = 2;
exports.CHAR_DATA_CODE_INDEX = 3;
var Lifecycle_1 = require("./common/Lifecycle");
exports.MAX_BUFFER_SIZE = 4294967295;
exports.NULL_CELL_CHAR = '';
exports.NULL_CELL_WIDTH = 1;
exports.NULL_CELL_CODE = 0;
exports.WHITESPACE_CELL_CHAR = ' ';
exports.WHITESPACE_CELL_WIDTH = 1;
exports.WHITESPACE_CELL_CODE = 32;
var Buffer = (function () {

@@ -40,6 +27,6 @@ function Buffer(_terminal, _hasScrollback) {

this._hasScrollback = _hasScrollback;
this.savedCurAttrData = exports.DEFAULT_ATTR_DATA.clone();
this.savedCurAttrData = BufferLine_1.DEFAULT_ATTR_DATA.clone();
this.markers = [];
this._nullCell = BufferLine_1.CellData.fromCharData([0, exports.NULL_CELL_CHAR, exports.NULL_CELL_WIDTH, exports.NULL_CELL_CODE]);
this._whitespaceCell = BufferLine_1.CellData.fromCharData([0, exports.WHITESPACE_CELL_CHAR, exports.WHITESPACE_CELL_WIDTH, exports.WHITESPACE_CELL_CODE]);
this._nullCell = BufferLine_1.CellData.fromCharData([0, BufferLine_1.NULL_CELL_CHAR, BufferLine_1.NULL_CELL_WIDTH, BufferLine_1.NULL_CELL_CODE]);
this._whitespaceCell = BufferLine_1.CellData.fromCharData([0, BufferLine_1.WHITESPACE_CELL_CHAR, BufferLine_1.WHITESPACE_CELL_WIDTH, BufferLine_1.WHITESPACE_CELL_CODE]);
this._cols = this._terminal.cols;

@@ -100,3 +87,3 @@ this._rows = this._terminal.rows;

if (fillAttr === undefined) {
fillAttr = exports.DEFAULT_ATTR_DATA;
fillAttr = BufferLine_1.DEFAULT_ATTR_DATA;
}

@@ -120,3 +107,3 @@ var i = this._rows;

Buffer.prototype.resize = function (newCols, newRows) {
var nullCell = this.getNullCell(exports.DEFAULT_ATTR_DATA);
var nullCell = this.getNullCell(BufferLine_1.DEFAULT_ATTR_DATA);
var newMaxLength = this._getCorrectBufferLength(newRows);

@@ -211,3 +198,3 @@ if (newMaxLength > this.lines.maxLength) {

Buffer.prototype._reflowLarger = function (newCols, newRows) {
var toRemove = BufferReflow_1.reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(exports.DEFAULT_ATTR_DATA));
var toRemove = BufferReflow_1.reflowLargerGetLinesToRemove(this.lines, this._cols, newCols, this.ybase + this.y, this.getNullCell(BufferLine_1.DEFAULT_ATTR_DATA));
if (toRemove.length > 0) {

@@ -220,3 +207,3 @@ var newLayoutResult = BufferReflow_1.reflowLargerCreateNewLayout(this.lines, toRemove);

Buffer.prototype._reflowLargerAdjustViewport = function (newCols, newRows, countRemoved) {
var nullCell = this.getNullCell(exports.DEFAULT_ATTR_DATA);
var nullCell = this.getNullCell(BufferLine_1.DEFAULT_ATTR_DATA);
var viewportAdjustments = countRemoved;

@@ -241,3 +228,3 @@ while (viewportAdjustments-- > 0) {

Buffer.prototype._reflowSmaller = function (newCols, newRows) {
var nullCell = this.getNullCell(exports.DEFAULT_ATTR_DATA);
var nullCell = this.getNullCell(BufferLine_1.DEFAULT_ATTR_DATA);
var toInsert = [];

@@ -271,3 +258,3 @@ var countToInsert = 0;

for (var i = 0; i < linesToAdd; i++) {
var newLine = this.getBlankLine(exports.DEFAULT_ATTR_DATA, true);
var newLine = this.getBlankLine(BufferLine_1.DEFAULT_ATTR_DATA, true);
newLines.push(newLine);

@@ -383,4 +370,4 @@ }

for (var i = 0; i < length_1; ++i) {
if (line.get(i)[exports.CHAR_DATA_WIDTH_INDEX]) {
stringIndex -= line.get(i)[exports.CHAR_DATA_CHAR_INDEX].length || 1;
if (line.get(i)[BufferLine_1.CHAR_DATA_WIDTH_INDEX]) {
stringIndex -= line.get(i)[BufferLine_1.CHAR_DATA_CHAR_INDEX].length || 1;
}

@@ -387,0 +374,0 @@ if (stringIndex < 0) {

import { IEvent, EventEmitter2 } from './EventEmitter2';
import { IDeleteEvent, IInsertEvent } from './CircularList';
export declare const DEFAULT_COLOR = 256;
export interface IDisposable {

@@ -4,0 +5,0 @@ dispose(): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_COLOR = 256;
//# sourceMappingURL=Types.js.map

@@ -15,1 +15,62 @@ export declare const enum KeyboardResultType {

}
export declare type CharData = [number, string, number, number];
export declare type IColorRGB = [number, number, number];
export interface IAttributeData {
fg: number;
bg: number;
clone(): IAttributeData;
isInverse(): number;
isBold(): number;
isUnderline(): number;
isBlink(): number;
isInvisible(): number;
isItalic(): number;
isDim(): number;
getFgColorMode(): number;
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
isFgPalette(): boolean;
isBgPalette(): boolean;
isFgDefault(): boolean;
isBgDefault(): boolean;
getFgColor(): number;
getBgColor(): number;
}
export interface ICellData extends IAttributeData {
content: number;
combinedData: string;
isCombined(): number;
getWidth(): number;
getChars(): string;
getCode(): number;
setFromCharData(value: CharData): void;
getAsCharData(): CharData;
}
export interface IBufferLine {
length: number;
isWrapped: boolean;
get(index: number): CharData;
set(index: number, value: CharData): void;
loadCell(index: number, cell: ICellData): ICellData;
setCell(index: number, cell: ICellData): void;
setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number): void;
addCodepointToCell(index: number, codePoint: number): void;
insertCells(pos: number, n: number, ch: ICellData): void;
deleteCells(pos: number, n: number, fill: ICellData): void;
replaceCells(start: number, end: number, fill: ICellData): void;
resize(cols: number, fill: ICellData): void;
fill(fillCellData: ICellData): void;
copyFrom(line: IBufferLine): void;
clone(): IBufferLine;
getTrimmedLength(): number;
translateToString(trimRight?: boolean, startCol?: number, endCol?: number): string;
getWidth(index: number): number;
hasWidth(index: number): number;
getFg(index: number): number;
getBg(index: number): number;
hasContent(index: number): number;
getCodePoint(index: number): number;
isCombined(index: number): number;
getString(index: number): string;
}

@@ -18,3 +18,2 @@ "use strict";

var Charsets_1 = require("./core/data/Charsets");
var Buffer_1 = require("./Buffer");
var CharWidth_1 = require("./CharWidth");

@@ -25,3 +24,3 @@ var EscapeSequenceParser_1 = require("./EscapeSequenceParser");

var TextDecoder_1 = require("./core/input/TextDecoder");
var BufferLine_1 = require("./BufferLine");
var BufferLine_1 = require("./core/buffer/BufferLine");
var EventEmitter2_1 = require("./common/EventEmitter2");

@@ -278,3 +277,3 @@ var GLEVEL = { '(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2 };

if (bufferRow.getWidth(cols - 1) === 2) {
bufferRow.setCellFromCodePoint(cols - 1, Buffer_1.NULL_CELL_CODE, Buffer_1.NULL_CELL_WIDTH, curAttr.fg, curAttr.bg);
bufferRow.setCellFromCodePoint(cols - 1, BufferLine_1.NULL_CELL_CODE, BufferLine_1.NULL_CELL_WIDTH, curAttr.fg, curAttr.bg);
}

@@ -555,3 +554,3 @@ }

buffer.lines.splice(buffer.ybase + buffer.scrollTop, 1);
buffer.lines.splice(buffer.ybase + buffer.scrollBottom, 0, buffer.getBlankLine(Buffer_1.DEFAULT_ATTR_DATA));
buffer.lines.splice(buffer.ybase + buffer.scrollBottom, 0, buffer.getBlankLine(BufferLine_1.DEFAULT_ATTR_DATA));
}

@@ -567,3 +566,3 @@ this._terminal.updateRange(buffer.scrollTop);

buffer.lines.splice(buffer.ybase + buffer.scrollBottom, 1);
buffer.lines.splice(buffer.ybase + buffer.scrollTop, 0, buffer.getBlankLine(Buffer_1.DEFAULT_ATTR_DATA));
buffer.lines.splice(buffer.ybase + buffer.scrollTop, 0, buffer.getBlankLine(BufferLine_1.DEFAULT_ATTR_DATA));
}

@@ -608,3 +607,3 @@ this._terminal.updateRange(buffer.scrollTop);

line.loadCell(buffer.x - 1, this._workCell);
line.replaceCells(buffer.x, buffer.x + (params[0] || 1), (this._workCell.content !== undefined) ? this._workCell : buffer.getNullCell(Buffer_1.DEFAULT_ATTR_DATA));
line.replaceCells(buffer.x, buffer.x + (params[0] || 1), (this._workCell.content !== undefined) ? this._workCell : buffer.getNullCell(BufferLine_1.DEFAULT_ATTR_DATA));
};

@@ -877,4 +876,4 @@ InputHandler.prototype.sendDeviceAttributes = function (params, collect) {

if (params.length === 1 && params[0] === 0) {
this._terminal.curAttrData.fg = Buffer_1.DEFAULT_ATTR_DATA.fg;
this._terminal.curAttrData.bg = Buffer_1.DEFAULT_ATTR_DATA.bg;
this._terminal.curAttrData.fg = BufferLine_1.DEFAULT_ATTR_DATA.fg;
this._terminal.curAttrData.bg = BufferLine_1.DEFAULT_ATTR_DATA.bg;
return;

@@ -904,4 +903,4 @@ }

else if (p === 0) {
attr.fg = Buffer_1.DEFAULT_ATTR_DATA.fg;
attr.bg = Buffer_1.DEFAULT_ATTR_DATA.bg;
attr.fg = BufferLine_1.DEFAULT_ATTR_DATA.fg;
attr.bg = BufferLine_1.DEFAULT_ATTR_DATA.bg;
}

@@ -950,7 +949,7 @@ else if (p === 1) {

attr.fg &= ~(50331648 | 16777215);
attr.fg |= Buffer_1.DEFAULT_ATTR_DATA.fg & (255 | 16777215);
attr.fg |= BufferLine_1.DEFAULT_ATTR_DATA.fg & (255 | 16777215);
}
else if (p === 49) {
attr.bg &= ~(50331648 | 16777215);
attr.bg |= Buffer_1.DEFAULT_ATTR_DATA.bg & (255 | 16777215);
attr.bg |= BufferLine_1.DEFAULT_ATTR_DATA.bg & (255 | 16777215);
}

@@ -989,5 +988,5 @@ else if (p === 38) {

attr.fg &= ~(50331648 | 16777215);
attr.fg |= Buffer_1.DEFAULT_ATTR_DATA.fg & (255 | 16777215);
attr.fg |= BufferLine_1.DEFAULT_ATTR_DATA.fg & (255 | 16777215);
attr.bg &= ~(50331648 | 16777215);
attr.bg |= Buffer_1.DEFAULT_ATTR_DATA.bg & (255 | 16777215);
attr.bg |= BufferLine_1.DEFAULT_ATTR_DATA.bg & (255 | 16777215);
}

@@ -1043,3 +1042,3 @@ else {

this._terminal.buffer.scrollBottom = this._terminal.rows - 1;
this._terminal.curAttrData = Buffer_1.DEFAULT_ATTR_DATA;
this._terminal.curAttrData = BufferLine_1.DEFAULT_ATTR_DATA;
this._terminal.buffer.x = this._terminal.buffer.y = 0;

@@ -1046,0 +1045,0 @@ this._terminal.charset = null;

@@ -74,2 +74,7 @@ "use strict";

});
Object.defineProperty(Terminal.prototype, "buffer", {
get: function () { return new BufferApiView(this._core.buffer); },
enumerable: true,
configurable: true
});
Object.defineProperty(Terminal.prototype, "markers", {

@@ -134,5 +139,11 @@ get: function () { return this._core.markers; },

};
Terminal.prototype.select = function (column, row, length) {
this._core.select(column, row, length);
};
Terminal.prototype.getSelection = function () {
return this._core.getSelection();
};
Terminal.prototype.getSelectionPosition = function () {
return this._core.getSelectionPosition();
};
Terminal.prototype.clearSelection = function () {

@@ -199,2 +210,77 @@ this._core.clearSelection();

exports.Terminal = Terminal;
var BufferApiView = (function () {
function BufferApiView(_buffer) {
this._buffer = _buffer;
}
Object.defineProperty(BufferApiView.prototype, "cursorY", {
get: function () { return this._buffer.y; },
enumerable: true,
configurable: true
});
Object.defineProperty(BufferApiView.prototype, "cursorX", {
get: function () { return this._buffer.x; },
enumerable: true,
configurable: true
});
Object.defineProperty(BufferApiView.prototype, "viewportY", {
get: function () { return this._buffer.ydisp; },
enumerable: true,
configurable: true
});
Object.defineProperty(BufferApiView.prototype, "baseY", {
get: function () { return this._buffer.ybase; },
enumerable: true,
configurable: true
});
Object.defineProperty(BufferApiView.prototype, "length", {
get: function () { return this._buffer.lines.length; },
enumerable: true,
configurable: true
});
BufferApiView.prototype.getLine = function (y) {
var line = this._buffer.lines.get(y);
if (!line) {
return undefined;
}
return new BufferLineApiView(line);
};
return BufferApiView;
}());
var BufferLineApiView = (function () {
function BufferLineApiView(_line) {
this._line = _line;
}
Object.defineProperty(BufferLineApiView.prototype, "isWrapped", {
get: function () { return this._line.isWrapped; },
enumerable: true,
configurable: true
});
BufferLineApiView.prototype.getCell = function (x) {
if (x < 0 || x >= this._line.length) {
return undefined;
}
return new BufferCellApiView(this._line, x);
};
BufferLineApiView.prototype.translateToString = function (trimRight, startColumn, endColumn) {
return this._line.translateToString(trimRight, startColumn, endColumn);
};
return BufferLineApiView;
}());
var BufferCellApiView = (function () {
function BufferCellApiView(_line, _x) {
this._line = _line;
this._x = _x;
}
Object.defineProperty(BufferCellApiView.prototype, "char", {
get: function () { return this._line.getString(this._x); },
enumerable: true,
configurable: true
});
Object.defineProperty(BufferCellApiView.prototype, "width", {
get: function () { return this._line.getWidth(this._x); },
enumerable: true,
configurable: true
});
return BufferCellApiView;
}());
//# sourceMappingURL=Terminal.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Types_1 = require("./Types");
var Types_1 = require("../../common/Types");
function generateConfig(scaledCharWidth, scaledCharHeight, terminal, colors) {

@@ -5,0 +5,0 @@ var clonedColors = {

@@ -20,2 +20,3 @@ "use strict";

var CharAtlasUtils_1 = require("./CharAtlasUtils");
var Types_2 = require("../../common/Types");
var StaticCharAtlas = (function (_super) {

@@ -50,4 +51,4 @@ __extends(StaticCharAtlas, _super);

var isBasicColor = glyph.fg < 16;
var isDefaultColor = glyph.fg === Types_1.DEFAULT_COLOR;
var isDefaultBackground = glyph.bg === Types_1.DEFAULT_COLOR;
var isDefaultColor = glyph.fg === Types_2.DEFAULT_COLOR;
var isDefaultBackground = glyph.bg === Types_2.DEFAULT_COLOR;
return isAscii && (isBasicColor || isDefaultColor) && isDefaultBackground && !glyph.italic;

@@ -63,3 +64,3 @@ };

}
else if (glyph.fg === Types_1.DEFAULT_COLOR) {
else if (glyph.fg === Types_2.DEFAULT_COLOR) {
if (glyph.bold) {

@@ -66,0 +67,0 @@ colorIndex = 1;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_COLOR = 256;
exports.INVERTED_DEFAULT_COLOR = 257;

@@ -5,0 +4,0 @@ exports.DIM_OPACITY = 0.5;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Types_1 = require("./atlas/Types");
var Types_1 = require("../common/Types");
var Types_2 = require("./atlas/Types");
var CharAtlasCache_1 = require("./atlas/CharAtlasCache");
var BufferLine_1 = require("../BufferLine");
var Buffer_1 = require("../Buffer");
var CharacterJoinerRegistry_1 = require("./CharacterJoinerRegistry");
var BufferLine_1 = require("../core/buffer/BufferLine");
var BaseRenderLayer = (function () {

@@ -131,3 +130,3 @@ function BaseRenderLayer(_container, id, zIndex, _alpha, _colors) {

BaseRenderLayer.prototype.drawChars = function (terminal, cell, x, y) {
if (cell.isFgRGB() || cell.isBgRGB() || cell instanceof CharacterJoinerRegistry_1.JoinedCellData) {
if (cell.isFgRGB() || cell.isBgRGB()) {
this._drawUncachedChars(terminal, cell, x, y);

@@ -139,4 +138,4 @@ return;

if (cell.isInverse()) {
fg = (cell.isBgDefault()) ? Types_1.INVERTED_DEFAULT_COLOR : cell.getBgColor();
bg = (cell.isFgDefault()) ? Types_1.INVERTED_DEFAULT_COLOR : cell.getFgColor();
fg = (cell.isBgDefault()) ? Types_2.INVERTED_DEFAULT_COLOR : cell.getBgColor();
bg = (cell.isFgDefault()) ? Types_2.INVERTED_DEFAULT_COLOR : cell.getFgColor();
}

@@ -147,6 +146,6 @@ else {

}
var drawInBrightColor = terminal.options.drawBoldTextInBrightColors && cell.isBold() && fg < 8 && fg !== Types_1.INVERTED_DEFAULT_COLOR;
var drawInBrightColor = terminal.options.drawBoldTextInBrightColors && cell.isBold() && fg < 8 && fg !== Types_2.INVERTED_DEFAULT_COLOR;
fg += drawInBrightColor ? 8 : 0;
this._currentGlyphIdentifier.chars = cell.getChars() || Buffer_1.WHITESPACE_CELL_CHAR;
this._currentGlyphIdentifier.code = cell.getCode() || Buffer_1.WHITESPACE_CELL_CODE;
this._currentGlyphIdentifier.chars = cell.getChars() || BufferLine_1.WHITESPACE_CELL_CHAR;
this._currentGlyphIdentifier.code = cell.getCode() || BufferLine_1.WHITESPACE_CELL_CODE;
this._currentGlyphIdentifier.bg = bg;

@@ -194,3 +193,3 @@ this._currentGlyphIdentifier.fg = fg;

if (cell.isDim()) {
this._ctx.globalAlpha = Types_1.DIM_OPACITY;
this._ctx.globalAlpha = Types_2.DIM_OPACITY;
}

@@ -197,0 +196,0 @@ this._ctx.fillText(cell.getChars(), x * this._scaledCellWidth + this._scaledCharLeft, y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight / 2);

@@ -16,4 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var BufferLine_1 = require("../BufferLine");
var Buffer_1 = require("../Buffer");
var BufferLine_1 = require("../core/buffer/BufferLine");
var JoinedCellData = (function (_super) {

@@ -108,3 +107,3 @@ __extends(JoinedCellData, _super);

}
currentStringIndex += this._workCell.getChars().length || Buffer_1.WHITESPACE_CELL_CHAR.length;
currentStringIndex += this._workCell.getChars().length || BufferLine_1.WHITESPACE_CELL_CHAR.length;
}

@@ -141,3 +140,3 @@ if (this._terminal.cols - rangeStartColumn > 1) {

var width = line.getWidth(x);
var length_1 = line.getString(x).length || Buffer_1.WHITESPACE_CELL_CHAR.length;
var length_1 = line.getString(x).length || BufferLine_1.WHITESPACE_CELL_CHAR.length;
if (width === 0) {

@@ -144,0 +143,0 @@ continue;

@@ -17,3 +17,3 @@ "use strict";

var BaseRenderLayer_1 = require("./BaseRenderLayer");
var BufferLine_1 = require("../BufferLine");
var BufferLine_1 = require("../core/buffer/BufferLine");
var BLINK_INTERVAL = 600;

@@ -20,0 +20,0 @@ var CursorRenderLayer = (function (_super) {

@@ -93,3 +93,3 @@ "use strict";

var _this = this;
this.dimensions.scaledCharWidth = Math.floor(this._terminal.charMeasure.width * window.devicePixelRatio);
this.dimensions.scaledCharWidth = this._terminal.charMeasure.width * window.devicePixelRatio;
this.dimensions.scaledCharHeight = Math.ceil(this._terminal.charMeasure.height * window.devicePixelRatio);

@@ -139,4 +139,4 @@ this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._terminal.options.letterSpacing);

(" background-color: " + this.colorManager.colors.background.css + ";") +
(" font-family: " + this._terminal.getOption('fontFamily') + ";") +
(" font-size: " + this._terminal.getOption('fontSize') + "px;") +
(" font-family: " + this._terminal.options.fontFamily + ";") +
(" font-size: " + this._terminal.options.fontSize + "px;") +
"}";

@@ -143,0 +143,0 @@ styles +=

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Buffer_1 = require("../../Buffer");
var Types_1 = require("../atlas/Types");
var BufferLine_1 = require("../../BufferLine");
var BufferLine_1 = require("../../core/buffer/BufferLine");
exports.BOLD_CLASS = 'xterm-bold';

@@ -25,3 +24,3 @@ exports.DIM_CLASS = 'xterm-dim';

for (var x = Math.min(lineData.length, cols) - 1; x >= 0; x--) {
if (lineData.loadCell(x, this._workCell).getCode() !== Buffer_1.NULL_CELL_CODE || (isCursorRow && x === cursorX)) {
if (lineData.loadCell(x, this._workCell).getCode() !== BufferLine_1.NULL_CELL_CODE || (isCursorRow && x === cursorX)) {
lineLength = x + 1;

@@ -70,3 +69,3 @@ break;

}
charElement.textContent = this._workCell.getChars() || Buffer_1.WHITESPACE_CELL_CHAR;
charElement.textContent = this._workCell.getChars() || BufferLine_1.WHITESPACE_CELL_CHAR;
var swapColor = this._workCell.isInverse();

@@ -73,0 +72,0 @@ if (this._workCell.isFgRGB()) {

@@ -16,6 +16,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var Buffer_1 = require("../Buffer");
var GridCache_1 = require("./GridCache");
var BaseRenderLayer_1 = require("./BaseRenderLayer");
var BufferLine_1 = require("../BufferLine");
var BufferLine_1 = require("../core/buffer/BufferLine");
var CharacterJoinerRegistry_1 = require("./CharacterJoinerRegistry");

@@ -67,3 +66,3 @@ var TextRenderLayer = (function (_super) {

if (!isJoined && this._isOverlapping(cell)) {
if (lastCharX < line.length - 1 && line.getCodePoint(lastCharX + 1) === Buffer_1.NULL_CELL_CODE) {
if (lastCharX < line.length - 1 && line.getCodePoint(lastCharX + 1) === BufferLine_1.NULL_CELL_CODE) {
cell.content &= ~12582912;

@@ -70,0 +69,0 @@ cell.content |= 2 << 22;

@@ -7,3 +7,3 @@ "use strict";

var AltClickHandler_1 = require("./handlers/AltClickHandler");
var BufferLine_1 = require("./BufferLine");
var BufferLine_1 = require("./core/buffer/BufferLine");
var EventEmitter2_1 = require("./common/EventEmitter2");

@@ -149,2 +149,3 @@ var DRAG_SCROLL_MAX_THRESHOLD = 50;

this.refresh();
this._onSelectionChange.fire();
};

@@ -151,0 +152,0 @@ SelectionManager.prototype.refresh = function (isLinuxMouseSelection) {

@@ -24,4 +24,3 @@ "use strict";

var Terminal_1 = require("./Terminal");
var Buffer_1 = require("./Buffer");
var BufferLine_1 = require("./BufferLine");
var BufferLine_1 = require("./core/buffer/BufferLine");
var TestTerminal = (function (_super) {

@@ -70,3 +69,3 @@ __extends(TestTerminal, _super);

for (var cell = 0; cell < term.cols; ++cell) {
lineText += term.buffer.lines.get(line).loadCell(cell, new BufferLine_1.CellData()).getChars() || Buffer_1.WHITESPACE_CELL_CHAR;
lineText += term.buffer.lines.get(line).loadCell(cell, new BufferLine_1.CellData()).getChars() || BufferLine_1.WHITESPACE_CELL_CHAR;
}

@@ -73,0 +72,0 @@ lineText = lineText.replace(/\s+$/, '');

@@ -41,2 +41,3 @@ "use strict";

var EventEmitter2_1 = require("./common/EventEmitter2");
var BufferLine_1 = require("./core/buffer/BufferLine");
var WindowsMode_1 = require("./WindowsMode");

@@ -200,4 +201,4 @@ var document = (typeof window !== 'undefined') ? window.document : null;

this.charsets = [null];
this.curAttrData = Buffer_1.DEFAULT_ATTR_DATA.clone();
this._eraseAttrData = Buffer_1.DEFAULT_ATTR_DATA.clone();
this.curAttrData = BufferLine_1.DEFAULT_ATTR_DATA.clone();
this._eraseAttrData = BufferLine_1.DEFAULT_ATTR_DATA.clone();
this.params = [];

@@ -1052,5 +1053,19 @@ this.currentParam = 0;

};
Terminal.prototype.select = function (column, row, length) {
this.selectionManager.setSelection(column, row, length);
};
Terminal.prototype.getSelection = function () {
return this.selectionManager ? this.selectionManager.selectionText : '';
};
Terminal.prototype.getSelectionPosition = function () {
if (!this.selectionManager.hasSelection) {
return undefined;
}
return {
startColumn: this.selectionManager.selectionStart[0],
startRow: this.selectionManager.selectionStart[1],
endColumn: this.selectionManager.selectionEnd[0],
endRow: this.selectionManager.selectionEnd[1]
};
};
Terminal.prototype.clearSelection = function () {

@@ -1227,3 +1242,3 @@ if (this.selectionManager) {

for (var i = 1; i < this.rows; i++) {
this.buffer.lines.push(this.buffer.getBlankLine(Buffer_1.DEFAULT_ATTR_DATA));
this.buffer.lines.push(this.buffer.getBlankLine(BufferLine_1.DEFAULT_ATTR_DATA));
}

@@ -1230,0 +1245,0 @@ this.refresh(0, this.rows - 1);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Buffer_1 = require("./Buffer");
var BufferLine_1 = require("./core/buffer/BufferLine");
function applyWindowsMode(terminal) {

@@ -8,3 +8,3 @@ return terminal.onLineFeed(function () {

var lastChar = line.get(terminal.cols - 1);
if (lastChar[Buffer_1.CHAR_DATA_CODE_INDEX] !== Buffer_1.NULL_CELL_CODE && lastChar[Buffer_1.CHAR_DATA_CODE_INDEX] !== Buffer_1.WHITESPACE_CELL_CODE) {
if (lastChar[BufferLine_1.CHAR_DATA_CODE_INDEX] !== BufferLine_1.NULL_CELL_CODE && lastChar[BufferLine_1.CHAR_DATA_CODE_INDEX] !== BufferLine_1.WHITESPACE_CELL_CODE) {
var nextLine = terminal.buffer.lines.get(terminal.buffer.ybase + terminal.buffer.y);

@@ -11,0 +11,0 @@ nextLine.isWrapped = true;

{
"name": "xterm",
"description": "Full xterm terminal, in your browser",
"version": "3.14.0-beta1",
"version": "3.14.0-beta10",
"main": "lib/public/Terminal.js",

@@ -15,2 +15,3 @@ "types": "typings/xterm.d.ts",

"@types/node": "6.0.108",
"@types/puppeteer": "^1.12.4",
"@types/webpack": "^4.4.11",

@@ -36,2 +37,3 @@ "browserify": "^13.3.0",

"nyc": "^11.8.0",
"puppeteer": "^1.15.0",
"sorcery": "^0.10.0",

@@ -59,2 +61,3 @@ "source-map-loader": "^0.2.4",

"test-coverage": "nyc -x gulpfile.js -x '**/*test*' npm run mocha",
"test-api": "mocha \"**/*.api.js\"",
"mocha": "gulp test",

@@ -61,0 +64,0 @@ "prebuild": "tsc -b ./src/tsconfig.all.json",

@@ -11,3 +11,2 @@ /**

buffer: any;
selectionManager: any;
}

@@ -14,0 +13,0 @@

@@ -38,3 +38,2 @@ /**

public findNext(term: string, searchOptions?: ISearchOptions): boolean {
const selectionManager = this._terminal._core.selectionManager;
const {incremental} = searchOptions;

@@ -44,3 +43,3 @@ let result: ISearchResult;

if (!term || term.length === 0) {
selectionManager.clearSelection();
this._terminal.clearSelection();
return false;

@@ -52,9 +51,8 @@ }

if (selectionManager.selectionEnd) {
if (this._terminal.hasSelection()) {
// Start from the selection end if there is a selection
// For incremental search, use existing row
if (this._terminal.getSelection().length !== 0) {
startRow = incremental ? selectionManager.selectionStart[1] : selectionManager.selectionEnd[1];
startCol = incremental ? selectionManager.selectionStart[0] : selectionManager.selectionEnd[0];
}
const currentSelection = this._terminal.getSelectionPosition();
startRow = incremental ? currentSelection.startRow : currentSelection.endRow;
startCol = incremental ? currentSelection.startColumn : currentSelection.endColumn;
}

@@ -115,7 +113,6 @@

public findPrevious(term: string, searchOptions?: ISearchOptions): boolean {
const selectionManager = this._terminal._core.selectionManager;
let result: ISearchResult;
if (!term || term.length === 0) {
selectionManager.clearSelection();
this._terminal.clearSelection();
return false;

@@ -128,8 +125,7 @@ }

if (selectionManager.selectionStart) {
if (this._terminal.hasSelection()) {
// Start from the selection start if there is a selection
if (this._terminal.getSelection().length !== 0) {
startRow = selectionManager.selectionStart[1];
startCol = selectionManager.selectionStart[0];
}
const currentSelection = this._terminal.getSelectionPosition();
startRow = currentSelection.startRow;
startCol = currentSelection.startColumn;
}

@@ -349,3 +345,3 @@

}
this._terminal._core.selectionManager.setSelection(result.col, result.row, result.term.length);
this._terminal.select(result.col, result.row, result.term.length);
this._terminal.scrollLines(result.row - this._terminal._core.buffer.ydisp);

@@ -352,0 +348,0 @@ return true;

@@ -7,39 +7,13 @@ /**

import { CircularList, IInsertEvent } from './common/CircularList';
import { ITerminal, IBuffer, IBufferLine, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult, ICellData, IAttributeData } from './Types';
import { ITerminal, IBuffer, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult } from './Types';
import { IBufferLine, ICellData, IAttributeData } from './core/Types';
import { IMarker } from 'xterm';
import { BufferLine, CellData, AttributeData } from './BufferLine';
import { BufferLine, CellData, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX, DEFAULT_ATTR_DATA } from './core/buffer/BufferLine';
import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from './BufferReflow';
import { DEFAULT_COLOR } from './renderer/atlas/Types';
import { EventEmitter2, IEvent } from './common/EventEmitter2';
import { Disposable } from '../lib/common/Lifecycle';
import { Disposable } from './common/Lifecycle';
export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);
export const DEFAULT_ATTR_DATA = new AttributeData();
export const CHAR_DATA_ATTR_INDEX = 0;
export const CHAR_DATA_CHAR_INDEX = 1;
export const CHAR_DATA_WIDTH_INDEX = 2;
export const CHAR_DATA_CODE_INDEX = 3;
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
/**
* Null cell - a real empty cell (containing nothing).
* Note that code should always be 0 for a null cell as
* several test condition of the buffer line rely on this.
*/
export const NULL_CELL_CHAR = '';
export const NULL_CELL_WIDTH = 1;
export const NULL_CELL_CODE = 0;
/**
* Whitespace cell.
* This is meant as a replacement for empty cells when needed
* during rendering lines to preserve correct aligment.
*/
export const WHITESPACE_CELL_CHAR = ' ';
export const WHITESPACE_CELL_WIDTH = 1;
export const WHITESPACE_CELL_CODE = 32;
/**
* This class represents a terminal buffer (an internal state of the terminal), where the

@@ -46,0 +20,0 @@ * following information is stored (in high-level):

@@ -6,5 +6,5 @@ /**

import { BufferLine } from './BufferLine';
import { BufferLine } from './core/buffer/BufferLine';
import { CircularList } from './common/CircularList';
import { IBufferLine, ICellData } from './Types';
import { IBufferLine, ICellData } from './core/Types';

@@ -11,0 +11,0 @@ export interface INewLayoutResult {

@@ -6,3 +6,4 @@ /**

import { ITerminal, IBufferSet, IAttributeData, IBuffer } from './Types';
import { ITerminal, IBufferSet, IBuffer } from './Types';
import { IAttributeData } from './core/Types';
import { Buffer } from './Buffer';

@@ -9,0 +10,0 @@ import { EventEmitter2, IEvent } from './common/EventEmitter2';

@@ -9,2 +9,4 @@ /**

export const DEFAULT_COLOR = 256;
export interface IDisposable {

@@ -11,0 +13,0 @@ dispose(): void;

@@ -22,1 +22,80 @@ /**

}
export type CharData = [number, string, number, number];
export type IColorRGB = [number, number, number];
/** Attribute data */
export interface IAttributeData {
fg: number;
bg: number;
clone(): IAttributeData;
// flags
isInverse(): number;
isBold(): number;
isUnderline(): number;
isBlink(): number;
isInvisible(): number;
isItalic(): number;
isDim(): number;
// color modes
getFgColorMode(): number;
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
isFgPalette(): boolean;
isBgPalette(): boolean;
isFgDefault(): boolean;
isBgDefault(): boolean;
// colors
getFgColor(): number;
getBgColor(): number;
}
/** Cell data */
export interface ICellData extends IAttributeData {
content: number;
combinedData: string;
isCombined(): number;
getWidth(): number;
getChars(): string;
getCode(): number;
setFromCharData(value: CharData): void;
getAsCharData(): CharData;
}
/**
* Interface for a line in the terminal buffer.
*/
export interface IBufferLine {
length: number;
isWrapped: boolean;
get(index: number): CharData;
set(index: number, value: CharData): void;
loadCell(index: number, cell: ICellData): ICellData;
setCell(index: number, cell: ICellData): void;
setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number): void;
addCodepointToCell(index: number, codePoint: number): void;
insertCells(pos: number, n: number, ch: ICellData): void;
deleteCells(pos: number, n: number, fill: ICellData): void;
replaceCells(start: number, end: number, fill: ICellData): void;
resize(cols: number, fill: ICellData): void;
fill(fillCellData: ICellData): void;
copyFrom(line: IBufferLine): void;
clone(): IBufferLine;
getTrimmedLength(): number;
translateToString(trimRight?: boolean, startCol?: number, endCol?: number): string;
/* direct access to cell attrs */
getWidth(index: number): number;
hasWidth(index: number): number;
getFg(index: number): number;
getBg(index: number): number;
hasContent(index: number): number;
getCodePoint(index: number): number;
isCombined(index: number): number;
getString(index: number): string;
}

@@ -6,3 +6,4 @@ /**

import { ITerminal, IBufferLine } from '../Types';
import { ITerminal } from '../Types';
import { IBufferLine } from '../core/Types';
import { ICircularList } from '../common/Types';

@@ -9,0 +10,0 @@ import { C0 } from '../common/data/EscapeSequences';

@@ -6,4 +6,5 @@ /**

import { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings } from 'xterm';
import { ITerminal } from '../Types';
import { Terminal as ITerminalApi, ITerminalOptions, IMarker, IDisposable, ILinkMatcherOptions, ITheme, ILocalizableStrings, IBuffer as IBufferApi, IBufferLine as IBufferLineApi, IBufferCell as IBufferCellApi, ISelectionPosition } from 'xterm';
import { ITerminal, IBuffer } from '../Types';
import { IBufferLine } from '../core/Types';
import { Terminal as TerminalCore } from '../Terminal';

@@ -34,2 +35,3 @@ import * as Strings from '../Strings';

public get cols(): number { return this._core.cols; }
public get buffer(): IBufferApi { return new BufferApiView(this._core.buffer); }
public get markers(): ReadonlyArray<IMarker> { return this._core.markers; }

@@ -99,5 +101,11 @@ public blur(): void {

}
public select(column: number, row: number, length: number): void {
this._core.select(column, row, length);
}
public getSelection(): string {
return this._core.getSelection();
}
public getSelectionPosition(): ISelectionPosition | undefined {
return this._core.getSelectionPosition();
}
public clearSelection(): void {

@@ -175,1 +183,39 @@ this._core.clearSelection();

}
class BufferApiView implements IBufferApi {
constructor(private _buffer: IBuffer) {}
public get cursorY(): number { return this._buffer.y; }
public get cursorX(): number { return this._buffer.x; }
public get viewportY(): number { return this._buffer.ydisp; }
public get baseY(): number { return this._buffer.ybase; }
public get length(): number { return this._buffer.lines.length; }
public getLine(y: number): IBufferLineApi | undefined {
const line = this._buffer.lines.get(y);
if (!line) {
return undefined;
}
return new BufferLineApiView(line);
}
}
class BufferLineApiView implements IBufferLineApi {
constructor(private _line: IBufferLine) {}
public get isWrapped(): boolean { return this._line.isWrapped; }
public getCell(x: number): IBufferCellApi | undefined {
if (x < 0 || x >= this._line.length) {
return undefined;
}
return new BufferCellApiView(this._line, x);
}
public translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string {
return this._line.translateToString(trimRight, startColumn, endColumn);
}
}
class BufferCellApiView implements IBufferCellApi {
constructor(private _line: IBufferLine, private _x: number) {}
public get char(): string { return this._line.getString(this._x); }
public get width(): number { return this._line.getWidth(this._x); }
}

@@ -8,3 +8,4 @@ /**

import { IColorSet } from '../Types';
import { DEFAULT_COLOR, ICharAtlasConfig } from './Types';
import { ICharAtlasConfig } from './Types';
import { DEFAULT_COLOR } from '../../common/Types';

@@ -11,0 +12,0 @@ export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig {

@@ -6,6 +6,7 @@ /**

import { DIM_OPACITY, IGlyphIdentifier, DEFAULT_COLOR, ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types';
import { DIM_OPACITY, IGlyphIdentifier, ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types';
import { generateStaticCharAtlasTexture } from './CharAtlasGenerator';
import BaseCharAtlas from './BaseCharAtlas';
import { is256Color } from './CharAtlasUtils';
import { DEFAULT_COLOR } from '../../common/Types';

@@ -12,0 +13,0 @@ export default class StaticCharAtlas extends BaseCharAtlas {

@@ -9,3 +9,2 @@ /**

export const DEFAULT_COLOR = 256;
export const INVERTED_DEFAULT_COLOR = 257;

@@ -12,0 +11,0 @@ export const DIM_OPACITY = 0.5;

@@ -7,9 +7,9 @@ /**

import { IRenderLayer, IColorSet, IRenderDimensions } from './Types';
import { ITerminal, ICellData } from '../Types';
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier, DEFAULT_COLOR } from './atlas/Types';
import { ITerminal } from '../Types';
import { ICellData } from '../core/Types';
import { DEFAULT_COLOR } from '../common/Types';
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier } from './atlas/Types';
import BaseCharAtlas from './atlas/BaseCharAtlas';
import { acquireCharAtlas } from './atlas/CharAtlasCache';
import { CellData, AttributeData } from '../BufferLine';
import { WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from '../Buffer';
import { JoinedCellData } from './CharacterJoinerRegistry';
import { CellData, AttributeData, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from '../core/buffer/BufferLine';

@@ -267,5 +267,5 @@ export abstract class BaseRenderLayer implements IRenderLayer {

// Note: to avoid bad runtime JoinedCellData will be skipped
// in the cache handler (atlasDidDraw == false) itself and
// in the cache handler itself (atlasDidDraw == false) and
// fall through to uncached later down below
if (cell.isFgRGB() || cell.isBgRGB() || cell instanceof JoinedCellData) {
if (cell.isFgRGB() || cell.isBgRGB()) {
this._drawUncachedChars(terminal, cell, x, y);

@@ -272,0 +272,0 @@ return;

@@ -1,5 +0,10 @@

import { ITerminal, IBufferLine, ICellData, CharData } from '../Types';
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { ITerminal } from '../Types';
import { IBufferLine, ICellData, CharData } from '../core/Types';
import { ICharacterJoinerRegistry, ICharacterJoiner } from './Types';
import { CellData, Content, AttributeData } from '../BufferLine';
import { WHITESPACE_CELL_CHAR } from '../Buffer';
import { CellData, Content, AttributeData, WHITESPACE_CELL_CHAR } from '../core/buffer/BufferLine';

@@ -6,0 +11,0 @@ export class JoinedCellData extends AttributeData implements ICellData {

@@ -8,4 +8,5 @@ /**

import { BaseRenderLayer } from './BaseRenderLayer';
import { ITerminal, ICellData } from '../Types';
import { CellData } from '../BufferLine';
import { ITerminal } from '../Types';
import { ICellData } from '../core/Types';
import { CellData } from '../core/buffer/BufferLine';

@@ -12,0 +13,0 @@ interface ICursorState {

@@ -104,3 +104,3 @@ /**

private _updateDimensions(): void {
this.dimensions.scaledCharWidth = Math.floor(this._terminal.charMeasure.width * window.devicePixelRatio);
this.dimensions.scaledCharWidth = this._terminal.charMeasure.width * window.devicePixelRatio;
this.dimensions.scaledCharHeight = Math.ceil(this._terminal.charMeasure.height * window.devicePixelRatio);

@@ -161,4 +161,4 @@ this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._terminal.options.letterSpacing);

` background-color: ${this.colorManager.colors.background.css};` +
` font-family: ${this._terminal.getOption('fontFamily')};` +
` font-size: ${this._terminal.getOption('fontSize')}px;` +
` font-family: ${this._terminal.options.fontFamily};` +
` font-size: ${this._terminal.options.fontSize}px;` +
`}`;

@@ -165,0 +165,0 @@ // Text styles

@@ -6,6 +6,6 @@ /**

import { NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from '../../Buffer';
import { IBufferLine, ITerminalOptions } from '../../Types';
import { ITerminalOptions } from '../../Types';
import { IBufferLine } from '../../core/Types';
import { INVERTED_DEFAULT_COLOR } from '../atlas/Types';
import { CellData, AttributeData } from '../../BufferLine';
import { CellData, AttributeData, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from '../../core/buffer/BufferLine';

@@ -12,0 +12,0 @@ export const BOLD_CLASS = 'xterm-bold';

@@ -6,8 +6,8 @@ /**

import { NULL_CELL_CODE } from '../Buffer';
import { IColorSet, IRenderDimensions, ICharacterJoinerRegistry } from './Types';
import { CharData, ITerminal, ICellData } from '../Types';
import { ITerminal } from '../Types';
import { CharData, ICellData } from '../core/Types';
import { GridCache } from './GridCache';
import { BaseRenderLayer } from './BaseRenderLayer';
import { CellData, AttributeData, Content } from '../BufferLine';
import { CellData, AttributeData, Content, NULL_CELL_CODE } from '../core/buffer/BufferLine';
import { JoinedCellData } from './CharacterJoinerRegistry';

@@ -14,0 +14,0 @@

@@ -6,3 +6,4 @@ /**

import { ITerminal, ISelectionManager, IBuffer, IBufferLine, ISelectionRedrawRequestEvent } from './Types';
import { ITerminal, ISelectionManager, IBuffer, ISelectionRedrawRequestEvent } from './Types';
import { IBufferLine } from './core/Types';
import { MouseHelper } from './MouseHelper';

@@ -13,3 +14,3 @@ import * as Browser from './common/Platform';

import { AltClickHandler } from './handlers/AltClickHandler';
import { CellData } from './BufferLine';
import { CellData } from './core/buffer/BufferLine';
import { IDisposable } from 'xterm';

@@ -250,2 +251,3 @@ import { EventEmitter2, IEvent } from './common/EventEmitter2';

this.refresh();
this._onSelectionChange.fire();
}

@@ -252,0 +254,0 @@

@@ -16,5 +16,4 @@ /**

import { Terminal } from './Terminal';
import { WHITESPACE_CELL_CHAR } from './Buffer';
import { IViewport } from './Types';
import { CellData } from './BufferLine';
import { CellData, WHITESPACE_CELL_CHAR } from './core/buffer/BufferLine';

@@ -21,0 +20,0 @@ class TestTerminal extends Terminal {

@@ -6,5 +6,5 @@ /**

import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable } from 'xterm';
import { ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable, IMarker, ISelectionPosition } from 'xterm';
import { IColorSet, IRenderer } from './renderer/Types';
import { ICharset } from './core/Types';
import { ICharset, IAttributeData, ICellData, IBufferLine, CharData } from './core/Types';
import { ICircularList } from './common/Types';

@@ -15,3 +15,2 @@ import { IEvent } from './common/EventEmitter2';

export type CharData = [number, string, number, number];
export type LineData = CharData[];

@@ -201,3 +200,3 @@

export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAccessor, ILinkifierAccessor {
export interface ITerminal extends IPublicTerminal, IElementAccessor, IBufferAccessor, ILinkifierAccessor {
screenElement: HTMLElement;

@@ -227,2 +226,52 @@ selectionManager: ISelectionManager;

export interface IPublicTerminal extends IDisposable, IEventEmitter {
textarea: HTMLTextAreaElement;
rows: number;
cols: number;
buffer: IBuffer;
markers: IMarker[];
onCursorMove: IEvent<void>;
onData: IEvent<string>;
onKey: IEvent<{ key: string, domEvent: KeyboardEvent }>;
onLineFeed: IEvent<void>;
onScroll: IEvent<number>;
onSelectionChange: IEvent<void>;
onRender: IEvent<{ start: number, end: number }>;
onResize: IEvent<{ cols: number, rows: number }>;
onTitleChange: IEvent<string>;
blur(): void;
focus(): void;
resize(columns: number, rows: number): void;
writeln(data: string): void;
open(parent: HTMLElement): void;
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
addCsiHandler(flag: string, callback: (params: number[], collect: string) => boolean): IDisposable;
addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
registerLinkMatcher(regex: RegExp, handler: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions): number;
deregisterLinkMatcher(matcherId: number): void;
registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
deregisterCharacterJoiner(joinerId: number): void;
addMarker(cursorYOffset: number): IMarker;
hasSelection(): boolean;
getSelection(): string;
getSelectionPosition(): ISelectionPosition | undefined;
clearSelection(): void;
select(column: number, row: number, length: number): void;
selectAll(): void;
selectLines(start: number, end: number): void;
dispose(): void;
destroy(): void;
scrollLines(amount: number): void;
scrollPages(pageCount: number): void;
scrollToTop(): void;
scrollToBottom(): void;
scrollToLine(line: number): void;
clear(): void;
write(data: string): void;
getOption(key: string): any;
setOption(key: string, value: any): void;
refresh(start: number, end: number): void;
reset(): void;
}
export interface IBufferAccessor {

@@ -532,81 +581,2 @@ buffer: IBuffer;

/** RGB color type */
export type IColorRGB = [number, number, number];
/** Attribute data */
export interface IAttributeData {
fg: number;
bg: number;
clone(): IAttributeData;
// flags
isInverse(): number;
isBold(): number;
isUnderline(): number;
isBlink(): number;
isInvisible(): number;
isItalic(): number;
isDim(): number;
// color modes
getFgColorMode(): number;
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
isFgPalette(): boolean;
isBgPalette(): boolean;
isFgDefault(): boolean;
isBgDefault(): boolean;
// colors
getFgColor(): number;
getBgColor(): number;
}
/** Cell data */
export interface ICellData extends IAttributeData {
content: number;
combinedData: string;
isCombined(): number;
getWidth(): number;
getChars(): string;
getCode(): number;
setFromCharData(value: CharData): void;
getAsCharData(): CharData;
}
/**
* Interface for a line in the terminal buffer.
*/
export interface IBufferLine {
length: number;
isWrapped: boolean;
get(index: number): CharData;
set(index: number, value: CharData): void;
loadCell(index: number, cell: ICellData): ICellData;
setCell(index: number, cell: ICellData): void;
setCellFromCodePoint(index: number, codePoint: number, width: number, fg: number, bg: number): void;
addCodepointToCell(index: number, codePoint: number): void;
insertCells(pos: number, n: number, ch: ICellData): void;
deleteCells(pos: number, n: number, fill: ICellData): void;
replaceCells(start: number, end: number, fill: ICellData): void;
resize(cols: number, fill: ICellData): void;
fill(fillCellData: ICellData): void;
copyFrom(line: IBufferLine): void;
clone(): IBufferLine;
getTrimmedLength(): number;
translateToString(trimRight?: boolean, startCol?: number, endCol?: number): string;
/* direct access to cell attrs */
getWidth(index: number): number;
hasWidth(index: number): number;
getFg(index: number): number;
getBg(index: number): number;
hasContent(index: number): number;
getCodePoint(index: number): number;
isCombined(index: number): number;
getString(index: number): string;
}
export interface IMouseZoneManager extends IDisposable {

@@ -613,0 +583,0 @@ add(zone: IMouseZone): void;

@@ -8,3 +8,3 @@ /**

import { ITerminal } from './Types';
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './Buffer';
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from './core/buffer/BufferLine';

@@ -11,0 +11,0 @@ export function applyWindowsMode(terminal: ITerminal): IDisposable {

@@ -278,3 +278,3 @@ /**

*/
leaveCallback?: (event: MouseEvent, uri: string) => boolean | void;
leaveCallback?: () => void;

@@ -360,2 +360,9 @@ /**

/**
* (EXPERIMENTAL) The terminal's current buffer, this might be either the
* normal buffer or the alt buffer depending on what's running in the
* terminal.
*/
readonly buffer: IBuffer;
/**
* (EXPERIMENTAL) Get all markers registered against the buffer. If the alt

@@ -599,2 +606,3 @@ * buffer is active this will always return [].

addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
/**

@@ -675,2 +683,7 @@ * (EXPERIMENTAL) Registers a link matcher, allowing custom link patterns to

/**
* Gets the selection position or undefined if there is no selection.
*/
getSelectionPosition(): ISelectionPosition | undefined;
/**
* Clears the current terminal selection.

@@ -681,2 +694,10 @@ */

/**
* Selects text within the terminal.
* @param column The column the selection starts at..
* @param row The row the selection starts at.
* @param length The length of the selection.
*/
select(column: number, row: number, length: number): void;
/**
* Selects all text within the terminal.

@@ -754,3 +775,3 @@ */

*/
getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell'): boolean;
getOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'rightClickSelectsWord' | 'popOnBell' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode'): boolean;
/**

@@ -806,3 +827,3 @@ * Retrieves an option's value from the terminal.

*/
setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'rightClickSelectsWord' | 'screenKeys' | 'useFlowControl' | 'visualBell', value: boolean): void;
setOption(key: 'allowTransparency' | 'cancelEvents' | 'convertEol' | 'cursorBlink' | 'debug' | 'disableStdin' | 'enableBold' | 'macOptionIsMeta' | 'popOnBell' | 'rightClickSelectsWord' | 'screenKeys' | 'useFlowControl' | 'visualBell' | 'windowsMode', value: boolean): void;
/**

@@ -865,2 +886,111 @@ * Sets an option on the terminal.

}
/**
* An object representing a selecrtion within the terminal.
*/
interface ISelectionPosition {
/**
* The start column of the selection.
*/
startColumn: number;
/**
* The start row of the selection.
*/
startRow: number;
/**
* The end column of the selection.
*/
endColumn: number;
/**
* The end row of the selection.
*/
endRow: number;
}
interface IBuffer {
/**
* The y position of the cursor. This ranges between `0` (when the
* cursor is at baseY) and `Terminal.rows - 1` (when the cursor is on the
* last row).
*/
readonly cursorY: number;
/**
* The x position of the cursor. This ranges between `0` (left side) and
* `Terminal.cols - 1` (right side).
*/
readonly cursorX: number;
/**
* The line within the buffer where the top of the viewport is.
*/
readonly viewportY: number;
/**
* The line within the buffer where the top of the bottom page is (when
* fully scrolled down);
*/
readonly baseY: number;
/**
* The amount of lines in the buffer.
*/
readonly length: number;
/**
* Gets a line from the buffer, or undefined if the line index does not exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
*
* @param y The line index to get.
*/
getLine(y: number): IBufferLine | undefined;
}
interface IBufferLine {
/**
* Whether the line is wrapped from the previous line.
*/
readonly isWrapped: boolean;
/**
* Gets a cell from the line, or undefined if the line index does not exist.
*
* Note that the result of this function should be used immediately after calling as when the
* terminal updates it could lead to unexpected behavior.
*
* @param x The character index to get.
*/
getCell(x: number): IBufferCell;
/**
* Gets the line as a string. Note that this is gets only the string for the line, not taking
* isWrapped into account.
*
* @param trimRight Whether to trim any whitespace at the right of the line.
* @param startColumn The column to start from (inclusive).
* @param endColumn The column to end at (exclusive).
*/
translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string;
}
interface IBufferCell {
/**
* The character within the cell.
*/
readonly char: string;
/**
* The width of the character. Some examples:
*
* - This is `1` for most cells.
* - This is `2` for wide character like CJK glyphs.
* - This is `0` for cells immediately following cells with a width of `2`.
*/
readonly width: number;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc