remove get CharData from codebase and deprecate method
This commit is contained in:
+10
-10
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { assert, expect } from 'chai';
|
import { assert, expect } from 'chai';
|
||||||
import { ITerminal } from './Types';
|
import { ITerminal } from './Types';
|
||||||
import { Buffer, DEFAULT_ATTR, CHAR_DATA_CHAR_INDEX } from './Buffer';
|
import { Buffer, DEFAULT_ATTR } from './Buffer';
|
||||||
import { CircularList } from './common/CircularList';
|
import { CircularList } from './common/CircularList';
|
||||||
import { MockTerminal, TestTerminal } from './ui/TestUtils.test';
|
import { MockTerminal, TestTerminal } from './ui/TestUtils.test';
|
||||||
import { BufferLine, CellData } from './BufferLine';
|
import { BufferLine, CellData } from './BufferLine';
|
||||||
@@ -37,13 +37,13 @@ describe('Buffer', () => {
|
|||||||
|
|
||||||
describe('fillViewportRows', () => {
|
describe('fillViewportRows', () => {
|
||||||
it('should fill the buffer with blank lines based on the size of the viewport', () => {
|
it('should fill the buffer with blank lines based on the size of the viewport', () => {
|
||||||
const blankLineChar = buffer.getBlankLine(DEFAULT_ATTR).get(0);
|
const blankLineChar = buffer.getBlankLine(DEFAULT_ATTR).loadCell(0, new CellData()).asCharData;
|
||||||
buffer.fillViewportRows();
|
buffer.fillViewportRows();
|
||||||
assert.equal(buffer.lines.length, INIT_ROWS);
|
assert.equal(buffer.lines.length, INIT_ROWS);
|
||||||
for (let y = 0; y < INIT_ROWS; y++) {
|
for (let y = 0; y < INIT_ROWS; y++) {
|
||||||
assert.equal(buffer.lines.get(y).length, INIT_COLS);
|
assert.equal(buffer.lines.get(y).length, INIT_COLS);
|
||||||
for (let x = 0; x < INIT_COLS; x++) {
|
for (let x = 0; x < INIT_COLS; x++) {
|
||||||
assert.deepEqual(buffer.lines.get(y).get(x), blankLineChar);
|
assert.deepEqual(buffer.lines.get(y).loadCell(x, new CellData()).asCharData, blankLineChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -155,15 +155,15 @@ describe('Buffer', () => {
|
|||||||
assert.equal(buffer.lines.maxLength, INIT_ROWS);
|
assert.equal(buffer.lines.maxLength, INIT_ROWS);
|
||||||
buffer.y = INIT_ROWS - 1;
|
buffer.y = INIT_ROWS - 1;
|
||||||
buffer.fillViewportRows();
|
buffer.fillViewportRows();
|
||||||
let chData = buffer.lines.get(5).get(0);
|
let chData = buffer.lines.get(5).loadCell(0, new CellData()).asCharData;
|
||||||
chData[1] = 'a';
|
chData[1] = 'a';
|
||||||
buffer.lines.get(5).setCell(0, CellData.fromCharData(chData));
|
buffer.lines.get(5).setCell(0, CellData.fromCharData(chData));
|
||||||
chData = buffer.lines.get(INIT_ROWS - 1).get(0);
|
chData = buffer.lines.get(INIT_ROWS - 1).loadCell(0, new CellData()).asCharData;
|
||||||
chData[1] = 'b';
|
chData[1] = 'b';
|
||||||
buffer.lines.get(INIT_ROWS - 1).setCell(0, CellData.fromCharData(chData));
|
buffer.lines.get(INIT_ROWS - 1).setCell(0, CellData.fromCharData(chData));
|
||||||
buffer.resize(INIT_COLS, INIT_ROWS - 5);
|
buffer.resize(INIT_COLS, INIT_ROWS - 5);
|
||||||
assert.equal(buffer.lines.get(0).get(0)[1], 'a');
|
assert.equal(buffer.lines.get(0).loadCell(0, new CellData()).asCharData[1], 'a');
|
||||||
assert.equal(buffer.lines.get(INIT_ROWS - 1 - 5).get(0)[1], 'b');
|
assert.equal(buffer.lines.get(INIT_ROWS - 1 - 5).loadCell(0, new CellData()).asCharData[1], 'b');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -497,7 +497,7 @@ describe('Buffer', () => {
|
|||||||
assert.equal(input, s);
|
assert.equal(input, s);
|
||||||
const stringIndex = s.match(/😃/).index;
|
const stringIndex = s.match(/😃/).index;
|
||||||
const bufferIndex = terminal.buffer.stringIndexToBufferIndex(0, stringIndex);
|
const bufferIndex = terminal.buffer.stringIndexToBufferIndex(0, stringIndex);
|
||||||
assert(terminal.buffer.lines.get(bufferIndex[0]).get(bufferIndex[1])[CHAR_DATA_CHAR_INDEX], '😃');
|
assert(terminal.buffer.lines.get(bufferIndex[0]).loadCell(bufferIndex[1], new CellData()).chars, '😃');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('multiline fullwidth chars with offset 1 (currently tests for broken behavior)', () => {
|
it('multiline fullwidth chars with offset 1 (currently tests for broken behavior)', () => {
|
||||||
@@ -524,7 +524,7 @@ describe('Buffer', () => {
|
|||||||
assert.equal(input, s);
|
assert.equal(input, s);
|
||||||
for (let i = 0; i < input.length; ++i) {
|
for (let i = 0; i < input.length; ++i) {
|
||||||
const bufferIndex = terminal.buffer.stringIndexToBufferIndex(0, i);
|
const bufferIndex = terminal.buffer.stringIndexToBufferIndex(0, i);
|
||||||
assert.equal(input[i], terminal.buffer.lines.get(bufferIndex[0]).get(bufferIndex[1])[CHAR_DATA_CHAR_INDEX]);
|
assert.equal(input[i], terminal.buffer.lines.get(bufferIndex[0]).loadCell(bufferIndex[1], new CellData()).chars);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -542,7 +542,7 @@ describe('Buffer', () => {
|
|||||||
: (i % 3 === 1)
|
: (i % 3 === 1)
|
||||||
? input.substr(i, 2)
|
? input.substr(i, 2)
|
||||||
: input.substr(i - 1, 2),
|
: input.substr(i - 1, 2),
|
||||||
terminal.buffer.lines.get(bufferIndex[0]).get(bufferIndex[1])[CHAR_DATA_CHAR_INDEX]);
|
terminal.buffer.lines.get(bufferIndex[0]).loadCell(bufferIndex[1], new CellData()).chars);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class TestBufferLine extends BufferLine {
|
|||||||
public toArray(): CharData[] {
|
public toArray(): CharData[] {
|
||||||
const result = [];
|
const result = [];
|
||||||
for (let i = 0; i < this.length; ++i) {
|
for (let i = 0; i < this.length; ++i) {
|
||||||
result.push(this.get(i));
|
result.push(this.loadCell(i, new CellData()).asCharData);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -25,15 +25,15 @@ describe('BufferLine', function(): void {
|
|||||||
chai.expect(line.isWrapped).equals(false);
|
chai.expect(line.isWrapped).equals(false);
|
||||||
line = new TestBufferLine(10);
|
line = new TestBufferLine(10);
|
||||||
chai.expect(line.length).equals(10);
|
chai.expect(line.length).equals(10);
|
||||||
chai.expect(line.get(0)).eql([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
|
chai.expect(line.loadCell(0, new CellData()).asCharData).eql([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
|
||||||
chai.expect(line.isWrapped).equals(false);
|
chai.expect(line.isWrapped).equals(false);
|
||||||
line = new TestBufferLine(10, null, true);
|
line = new TestBufferLine(10, null, true);
|
||||||
chai.expect(line.length).equals(10);
|
chai.expect(line.length).equals(10);
|
||||||
chai.expect(line.get(0)).eql([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
|
chai.expect(line.loadCell(0, new CellData()).asCharData).eql([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
|
||||||
chai.expect(line.isWrapped).equals(true);
|
chai.expect(line.isWrapped).equals(true);
|
||||||
line = new TestBufferLine(10, CellData.fromCharData([123, 'a', 456, 'a'.charCodeAt(0)]), true);
|
line = new TestBufferLine(10, CellData.fromCharData([123, 'a', 456, 'a'.charCodeAt(0)]), true);
|
||||||
chai.expect(line.length).equals(10);
|
chai.expect(line.length).equals(10);
|
||||||
chai.expect(line.get(0)).eql([123, 'a', 456, 'a'.charCodeAt(0)]);
|
chai.expect(line.loadCell(0, new CellData()).asCharData).eql([123, 'a', 456, 'a'.charCodeAt(0)]);
|
||||||
chai.expect(line.isWrapped).equals(true);
|
chai.expect(line.isWrapped).equals(true);
|
||||||
});
|
});
|
||||||
it('insertCells', function(): void {
|
it('insertCells', function(): void {
|
||||||
|
|||||||
@@ -129,6 +129,9 @@ export class CellData implements ICellData {
|
|||||||
this.content = Content.IS_COMBINED | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);
|
this.content = Content.IS_COMBINED | (value[CHAR_DATA_WIDTH_INDEX] << Content.WIDTH_SHIFT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public get asCharData(): CharData {
|
||||||
|
return [this.fg, this.chars, this.width, this.code];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -150,6 +153,10 @@ export class BufferLine implements IBufferLine {
|
|||||||
this.length = cols;
|
this.length = cols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get cell data CharData.
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
public get(index: number): CharData {
|
public get(index: number): CharData {
|
||||||
const content = this._data[index * CELL_SIZE + Cell.CONTENT];
|
const content = this._data[index * CELL_SIZE + Cell.CONTENT];
|
||||||
const cp = content & Content.CODEPOINT_MASK;
|
const cp = content & Content.CODEPOINT_MASK;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { assert } from 'chai';
|
|||||||
import { getStringCellWidth, wcwidth } from './CharWidth';
|
import { getStringCellWidth, wcwidth } from './CharWidth';
|
||||||
import { IBuffer } from './Types';
|
import { IBuffer } from './Types';
|
||||||
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './Buffer';
|
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './Buffer';
|
||||||
|
import { CellData } from './BufferLine';
|
||||||
|
|
||||||
|
|
||||||
describe('getStringCellWidth', function(): void {
|
describe('getStringCellWidth', function(): void {
|
||||||
@@ -22,7 +23,7 @@ describe('getStringCellWidth', function(): void {
|
|||||||
for (let i = start; i < end; ++i) {
|
for (let i = start; i < end; ++i) {
|
||||||
const line = buffer.lines.get(i);
|
const line = buffer.lines.get(i);
|
||||||
for (let j = 0; j < line.length; ++j) { // TODO: change to trimBorder with multiline
|
for (let j = 0; j < line.length; ++j) { // TODO: change to trimBorder with multiline
|
||||||
const ch = line.get(j);
|
const ch = line.loadCell(j, new CellData()).asCharData;
|
||||||
result += ch[CHAR_DATA_WIDTH_INDEX];
|
result += ch[CHAR_DATA_WIDTH_INDEX];
|
||||||
// return on sentinel
|
// return on sentinel
|
||||||
if (ch[CHAR_DATA_CHAR_INDEX] === sentinel) {
|
if (ch[CHAR_DATA_CHAR_INDEX] === sentinel) {
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
import { assert, expect } from 'chai';
|
import { assert, expect } from 'chai';
|
||||||
import { InputHandler } from './InputHandler';
|
import { InputHandler } from './InputHandler';
|
||||||
import { MockInputHandlingTerminal } from './ui/TestUtils.test';
|
import { MockInputHandlingTerminal } from './ui/TestUtils.test';
|
||||||
import { CHAR_DATA_ATTR_INDEX, DEFAULT_ATTR } from './Buffer';
|
import { DEFAULT_ATTR } from './Buffer';
|
||||||
import { Terminal } from './Terminal';
|
import { Terminal } from './Terminal';
|
||||||
import { IBufferLine } from './Types';
|
import { IBufferLine } from './Types';
|
||||||
|
import { CellData } from './BufferLine';
|
||||||
|
|
||||||
describe('InputHandler', () => {
|
describe('InputHandler', () => {
|
||||||
describe('save and restore cursor', () => {
|
describe('save and restore cursor', () => {
|
||||||
@@ -356,45 +357,45 @@ describe('InputHandler', () => {
|
|||||||
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('');
|
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('');
|
||||||
expect(term.buffer.translateBufferLineToString(1, true)).to.equal(' TEST');
|
expect(term.buffer.translateBufferLineToString(1, true)).to.equal(' TEST');
|
||||||
// Text color of 'TEST' should be red
|
// Text color of 'TEST' should be red
|
||||||
expect((term.buffer.lines.get(1).get(4)[CHAR_DATA_ATTR_INDEX] >> 9) & 0x1ff).to.equal(1);
|
expect((term.buffer.lines.get(1).loadCell(4, new CellData()).fg >> 9) & 0x1ff).to.equal(1);
|
||||||
});
|
});
|
||||||
it('should handle DECSET/DECRST 1047 (alt screen buffer)', () => {
|
it('should handle DECSET/DECRST 1047 (alt screen buffer)', () => {
|
||||||
handler.parse('\x1b[?1047h\r\n\x1b[31mJUNK\x1b[?1047lTEST');
|
handler.parse('\x1b[?1047h\r\n\x1b[31mJUNK\x1b[?1047lTEST');
|
||||||
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('');
|
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('');
|
||||||
expect(term.buffer.translateBufferLineToString(1, true)).to.equal(' TEST');
|
expect(term.buffer.translateBufferLineToString(1, true)).to.equal(' TEST');
|
||||||
// Text color of 'TEST' should be red
|
// Text color of 'TEST' should be red
|
||||||
expect((term.buffer.lines.get(1).get(4)[CHAR_DATA_ATTR_INDEX] >> 9) & 0x1ff).to.equal(1);
|
expect((term.buffer.lines.get(1).loadCell(4, new CellData()).fg >> 9) & 0x1ff).to.equal(1);
|
||||||
});
|
});
|
||||||
it('should handle DECSET/DECRST 1048 (alt screen cursor)', () => {
|
it('should handle DECSET/DECRST 1048 (alt screen cursor)', () => {
|
||||||
handler.parse('\x1b[?1048h\r\n\x1b[31mJUNK\x1b[?1048lTEST');
|
handler.parse('\x1b[?1048h\r\n\x1b[31mJUNK\x1b[?1048lTEST');
|
||||||
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('TEST');
|
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('TEST');
|
||||||
expect(term.buffer.translateBufferLineToString(1, true)).to.equal('JUNK');
|
expect(term.buffer.translateBufferLineToString(1, true)).to.equal('JUNK');
|
||||||
// Text color of 'TEST' should be default
|
// Text color of 'TEST' should be default
|
||||||
expect(term.buffer.lines.get(0).get(0)[CHAR_DATA_ATTR_INDEX]).to.equal(DEFAULT_ATTR);
|
expect(term.buffer.lines.get(0).loadCell(0, new CellData()).fg).to.equal(DEFAULT_ATTR);
|
||||||
// Text color of 'JUNK' should be red
|
// Text color of 'JUNK' should be red
|
||||||
expect((term.buffer.lines.get(1).get(0)[CHAR_DATA_ATTR_INDEX] >> 9) & 0x1ff).to.equal(1);
|
expect((term.buffer.lines.get(1).loadCell(0, new CellData()).fg >> 9) & 0x1ff).to.equal(1);
|
||||||
});
|
});
|
||||||
it('should handle DECSET/DECRST 1049 (alt screen buffer+cursor)', () => {
|
it('should handle DECSET/DECRST 1049 (alt screen buffer+cursor)', () => {
|
||||||
handler.parse('\x1b[?1049h\r\n\x1b[31mJUNK\x1b[?1049lTEST');
|
handler.parse('\x1b[?1049h\r\n\x1b[31mJUNK\x1b[?1049lTEST');
|
||||||
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('TEST');
|
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('TEST');
|
||||||
expect(term.buffer.translateBufferLineToString(1, true)).to.equal('');
|
expect(term.buffer.translateBufferLineToString(1, true)).to.equal('');
|
||||||
// Text color of 'TEST' should be default
|
// Text color of 'TEST' should be default
|
||||||
expect(term.buffer.lines.get(0).get(0)[CHAR_DATA_ATTR_INDEX]).to.equal(DEFAULT_ATTR);
|
expect(term.buffer.lines.get(0).loadCell(0, new CellData()).fg).to.equal(DEFAULT_ATTR);
|
||||||
});
|
});
|
||||||
it('should handle DECSET/DECRST 1049 - maintains saved cursor for alt buffer', () => {
|
it('should handle DECSET/DECRST 1049 - maintains saved cursor for alt buffer', () => {
|
||||||
handler.parse('\x1b[?1049h\r\n\x1b[31m\x1b[s\x1b[?1049lTEST');
|
handler.parse('\x1b[?1049h\r\n\x1b[31m\x1b[s\x1b[?1049lTEST');
|
||||||
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('TEST');
|
expect(term.buffer.translateBufferLineToString(0, true)).to.equal('TEST');
|
||||||
// Text color of 'TEST' should be default
|
// Text color of 'TEST' should be default
|
||||||
expect(term.buffer.lines.get(0).get(0)[CHAR_DATA_ATTR_INDEX]).to.equal(DEFAULT_ATTR);
|
expect(term.buffer.lines.get(0).loadCell(0, new CellData()).fg).to.equal(DEFAULT_ATTR);
|
||||||
handler.parse('\x1b[?1049h\x1b[uTEST');
|
handler.parse('\x1b[?1049h\x1b[uTEST');
|
||||||
expect(term.buffer.translateBufferLineToString(1, true)).to.equal('TEST');
|
expect(term.buffer.translateBufferLineToString(1, true)).to.equal('TEST');
|
||||||
// Text color of 'TEST' should be red
|
// Text color of 'TEST' should be red
|
||||||
expect((term.buffer.lines.get(1).get(0)[CHAR_DATA_ATTR_INDEX] >> 9) & 0x1ff).to.equal(1);
|
expect((term.buffer.lines.get(1).loadCell(0, new CellData()).fg >> 9) & 0x1ff).to.equal(1);
|
||||||
});
|
});
|
||||||
it('should handle DECSET/DECRST 1049 - clears alt buffer with erase attributes', () => {
|
it('should handle DECSET/DECRST 1049 - clears alt buffer with erase attributes', () => {
|
||||||
handler.parse('\x1b[42m\x1b[?1049h');
|
handler.parse('\x1b[42m\x1b[?1049h');
|
||||||
// Buffer should be filled with green background
|
// Buffer should be filled with green background
|
||||||
expect(term.buffer.lines.get(20).get(10)[CHAR_DATA_ATTR_INDEX] & 0x1ff).to.equal(2);
|
expect(term.buffer.lines.get(20).loadCell(10, new CellData()).fg & 0x1ff).to.equal(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,8 +13,9 @@ import * as path from 'path';
|
|||||||
import * as pty from 'node-pty';
|
import * as pty from 'node-pty';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { Terminal } from './Terminal';
|
import { Terminal } from './Terminal';
|
||||||
import { CHAR_DATA_CHAR_INDEX, WHITESPACE_CELL_CHAR } from './Buffer';
|
import { WHITESPACE_CELL_CHAR } from './Buffer';
|
||||||
import { IViewport } from './Types';
|
import { IViewport } from './Types';
|
||||||
|
import { CellData } from './BufferLine';
|
||||||
|
|
||||||
class TestTerminal extends Terminal {
|
class TestTerminal extends Terminal {
|
||||||
innerWrite(): void { this._innerWrite(); }
|
innerWrite(): void { this._innerWrite(); }
|
||||||
@@ -67,7 +68,7 @@ function terminalToString(term: Terminal): string {
|
|||||||
for (let line = term.buffer.ybase; line < term.buffer.ybase + term.rows; line++) {
|
for (let line = term.buffer.ybase; line < term.buffer.ybase + term.rows; line++) {
|
||||||
lineText = '';
|
lineText = '';
|
||||||
for (let cell = 0; cell < term.cols; ++cell) {
|
for (let cell = 0; cell < term.cols; ++cell) {
|
||||||
lineText += term.buffer.lines.get(line).get(cell)[CHAR_DATA_CHAR_INDEX] || WHITESPACE_CELL_CHAR;
|
lineText += term.buffer.lines.get(line).loadCell(cell, new CellData()).chars || WHITESPACE_CELL_CHAR;
|
||||||
}
|
}
|
||||||
// rtrim empty cells as xterm does
|
// rtrim empty cells as xterm does
|
||||||
lineText = lineText.replace(/\s+$/, '');
|
lineText = lineText.replace(/\s+$/, '');
|
||||||
|
|||||||
+182
-171
@@ -6,7 +6,7 @@
|
|||||||
import { assert, expect } from 'chai';
|
import { assert, expect } from 'chai';
|
||||||
import { Terminal } from './Terminal';
|
import { Terminal } from './Terminal';
|
||||||
import { MockViewport, MockCompositionHelper, MockRenderer } from './ui/TestUtils.test';
|
import { MockViewport, MockCompositionHelper, MockRenderer } from './ui/TestUtils.test';
|
||||||
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, DEFAULT_ATTR } from './Buffer';
|
import { DEFAULT_ATTR } from './Buffer';
|
||||||
import { CellData } from './BufferLine';
|
import { CellData } from './BufferLine';
|
||||||
|
|
||||||
const INIT_COLS = 80;
|
const INIT_COLS = 80;
|
||||||
@@ -461,9 +461,9 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.y = INIT_ROWS - 1; // Move cursor to last line
|
term.buffer.y = INIT_ROWS - 1; // Move cursor to last line
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS + 1);
|
assert.equal(term.buffer.lines.length, INIT_ROWS + 1);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'a');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'a');
|
||||||
assert.equal(term.buffer.lines.get(INIT_ROWS - 1).get(0)[CHAR_DATA_CHAR_INDEX], 'b');
|
assert.equal(term.buffer.lines.get(INIT_ROWS - 1).loadCell(0, new CellData()).chars, 'b');
|
||||||
assert.equal(term.buffer.lines.get(INIT_ROWS).get(0)[CHAR_DATA_CHAR_INDEX], '');
|
assert.equal(term.buffer.lines.get(INIT_ROWS).loadCell(0, new CellData()).chars, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly scroll inside a scroll region (scrollTop set)', () => {
|
it('should properly scroll inside a scroll region (scrollTop set)', () => {
|
||||||
@@ -474,8 +474,8 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.scrollTop = 1;
|
term.buffer.scrollTop = 1;
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'a');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'a');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], 'c');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, 'c');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly scroll inside a scroll region (scrollBottom set)', () => {
|
it('should properly scroll inside a scroll region (scrollBottom set)', () => {
|
||||||
@@ -488,12 +488,12 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.scrollBottom = 3;
|
term.buffer.scrollBottom = 3;
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS + 1);
|
assert.equal(term.buffer.lines.length, INIT_ROWS + 1);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'a', '\'a\' should be pushed to the scrollback');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'a', '\'a\' should be pushed to the scrollback');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], 'b');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, 'b');
|
||||||
assert.equal(term.buffer.lines.get(2).get(0)[CHAR_DATA_CHAR_INDEX], 'c');
|
assert.equal(term.buffer.lines.get(2).loadCell(0, new CellData()).chars, 'c');
|
||||||
assert.equal(term.buffer.lines.get(3).get(0)[CHAR_DATA_CHAR_INDEX], 'd');
|
assert.equal(term.buffer.lines.get(3).loadCell(0, new CellData()).chars, 'd');
|
||||||
assert.equal(term.buffer.lines.get(4).get(0)[CHAR_DATA_CHAR_INDEX], '', 'a blank line should be added at scrollBottom\'s index');
|
assert.equal(term.buffer.lines.get(4).loadCell(0, new CellData()).chars, '', 'a blank line should be added at scrollBottom\'s index');
|
||||||
assert.equal(term.buffer.lines.get(5).get(0)[CHAR_DATA_CHAR_INDEX], 'e');
|
assert.equal(term.buffer.lines.get(5).loadCell(0, new CellData()).chars, 'e');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly scroll inside a scroll region (scrollTop and scrollBottom set)', () => {
|
it('should properly scroll inside a scroll region (scrollTop and scrollBottom set)', () => {
|
||||||
@@ -507,11 +507,11 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.scrollBottom = 3;
|
term.buffer.scrollBottom = 3;
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'a');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'a');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], 'c', '\'b\' should be removed from the buffer');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, 'c', '\'b\' should be removed from the buffer');
|
||||||
assert.equal(term.buffer.lines.get(2).get(0)[CHAR_DATA_CHAR_INDEX], 'd');
|
assert.equal(term.buffer.lines.get(2).loadCell(0, new CellData()).chars, 'd');
|
||||||
assert.equal(term.buffer.lines.get(3).get(0)[CHAR_DATA_CHAR_INDEX], '', 'a blank line should be added at scrollBottom\'s index');
|
assert.equal(term.buffer.lines.get(3).loadCell(0, new CellData()).chars, '', 'a blank line should be added at scrollBottom\'s index');
|
||||||
assert.equal(term.buffer.lines.get(4).get(0)[CHAR_DATA_CHAR_INDEX], 'e');
|
assert.equal(term.buffer.lines.get(4).loadCell(0, new CellData()).chars, 'e');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -530,10 +530,10 @@ describe('term.js addons', () => {
|
|||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
||||||
// 'a' gets pushed out of buffer
|
// 'a' gets pushed out of buffer
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'b');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'b');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], '');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, '');
|
||||||
assert.equal(term.buffer.lines.get(INIT_ROWS - 2).get(0)[CHAR_DATA_CHAR_INDEX], 'c');
|
assert.equal(term.buffer.lines.get(INIT_ROWS - 2).loadCell(0, new CellData()).chars, 'c');
|
||||||
assert.equal(term.buffer.lines.get(INIT_ROWS - 1).get(0)[CHAR_DATA_CHAR_INDEX], '');
|
assert.equal(term.buffer.lines.get(INIT_ROWS - 1).loadCell(0, new CellData()).chars, '');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly scroll inside a scroll region (scrollTop set)', () => {
|
it('should properly scroll inside a scroll region (scrollTop set)', () => {
|
||||||
@@ -544,8 +544,8 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.scrollTop = 1;
|
term.buffer.scrollTop = 1;
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'a');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'a');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], 'c');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, 'c');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly scroll inside a scroll region (scrollBottom set)', () => {
|
it('should properly scroll inside a scroll region (scrollBottom set)', () => {
|
||||||
@@ -558,11 +558,11 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.scrollBottom = 3;
|
term.buffer.scrollBottom = 3;
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'b');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'b');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], 'c');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, 'c');
|
||||||
assert.equal(term.buffer.lines.get(2).get(0)[CHAR_DATA_CHAR_INDEX], 'd');
|
assert.equal(term.buffer.lines.get(2).loadCell(0, new CellData()).chars, 'd');
|
||||||
assert.equal(term.buffer.lines.get(3).get(0)[CHAR_DATA_CHAR_INDEX], '', 'a blank line should be added at scrollBottom\'s index');
|
assert.equal(term.buffer.lines.get(3).loadCell(0, new CellData()).chars, '', 'a blank line should be added at scrollBottom\'s index');
|
||||||
assert.equal(term.buffer.lines.get(4).get(0)[CHAR_DATA_CHAR_INDEX], 'e');
|
assert.equal(term.buffer.lines.get(4).loadCell(0, new CellData()).chars, 'e');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should properly scroll inside a scroll region (scrollTop and scrollBottom set)', () => {
|
it('should properly scroll inside a scroll region (scrollTop and scrollBottom set)', () => {
|
||||||
@@ -576,11 +576,11 @@ describe('term.js addons', () => {
|
|||||||
term.buffer.scrollBottom = 3;
|
term.buffer.scrollBottom = 3;
|
||||||
term.scroll();
|
term.scroll();
|
||||||
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
assert.equal(term.buffer.lines.length, INIT_ROWS);
|
||||||
assert.equal(term.buffer.lines.get(0).get(0)[CHAR_DATA_CHAR_INDEX], 'a');
|
assert.equal(term.buffer.lines.get(0).loadCell(0, new CellData()).chars, 'a');
|
||||||
assert.equal(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX], 'c', '\'b\' should be removed from the buffer');
|
assert.equal(term.buffer.lines.get(1).loadCell(0, new CellData()).chars, 'c', '\'b\' should be removed from the buffer');
|
||||||
assert.equal(term.buffer.lines.get(2).get(0)[CHAR_DATA_CHAR_INDEX], 'd');
|
assert.equal(term.buffer.lines.get(2).loadCell(0, new CellData()).chars, 'd');
|
||||||
assert.equal(term.buffer.lines.get(3).get(0)[CHAR_DATA_CHAR_INDEX], '', 'a blank line should be added at scrollBottom\'s index');
|
assert.equal(term.buffer.lines.get(3).loadCell(0, new CellData()).chars, '', 'a blank line should be added at scrollBottom\'s index');
|
||||||
assert.equal(term.buffer.lines.get(4).get(0)[CHAR_DATA_CHAR_INDEX], 'e');
|
assert.equal(term.buffer.lines.get(4).loadCell(0, new CellData()).chars, 'e');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -771,116 +771,126 @@ describe('term.js addons', () => {
|
|||||||
it('2 characters per cell', function (): void {
|
it('2 characters per cell', function (): void {
|
||||||
this.timeout(10000); // This is needed because istanbul patches code and slows it down
|
this.timeout(10000); // This is needed because istanbul patches code and slows it down
|
||||||
const high = String.fromCharCode(0xD800);
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
||||||
term.write(high + String.fromCharCode(i));
|
term.write(high + String.fromCharCode(i));
|
||||||
const tchar = term.buffer.lines.get(0).get(0);
|
const tchar = term.buffer.lines.get(0).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql(high + String.fromCharCode(i));
|
expect(tchar.chars).eql(high + String.fromCharCode(i));
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(tchar.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(tchar.width).eql(1);
|
||||||
expect(term.buffer.lines.get(0).get(1)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(0).loadCell(1, cell).chars).eql('');
|
||||||
term.reset();
|
term.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('2 characters at last cell', () => {
|
it('2 characters at last cell', () => {
|
||||||
const high = String.fromCharCode(0xD800);
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
||||||
term.buffer.x = term.cols - 1;
|
term.buffer.x = term.cols - 1;
|
||||||
term.write(high + String.fromCharCode(i));
|
term.write(high + String.fromCharCode(i));
|
||||||
expect(term.buffer.lines.get(0).get(term.buffer.x - 1)[CHAR_DATA_CHAR_INDEX]).eql(high + String.fromCharCode(i));
|
expect(term.buffer.lines.get(0).loadCell(term.buffer.x - 1, cell).chars).eql(high + String.fromCharCode(i));
|
||||||
expect(term.buffer.lines.get(0).get(term.buffer.x - 1)[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(term.buffer.lines.get(0).loadCell(term.buffer.x - 1, cell).chars.length).eql(2);
|
||||||
expect(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(1).loadCell(0, cell).chars).eql('');
|
||||||
term.reset();
|
term.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('2 characters per cell over line end with autowrap', () => {
|
it('2 characters per cell over line end with autowrap', () => {
|
||||||
const high = String.fromCharCode(0xD800);
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
||||||
term.buffer.x = term.cols - 1;
|
term.buffer.x = term.cols - 1;
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.write('a' + high + String.fromCharCode(i));
|
term.write('a' + high + String.fromCharCode(i));
|
||||||
expect(term.buffer.lines.get(0).get(term.cols - 1)[CHAR_DATA_CHAR_INDEX]).eql('a');
|
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).chars).eql('a');
|
||||||
expect(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX]).eql(high + String.fromCharCode(i));
|
expect(term.buffer.lines.get(1).loadCell(0, cell).chars).eql(high + String.fromCharCode(i));
|
||||||
expect(term.buffer.lines.get(1).get(0)[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(term.buffer.lines.get(1).loadCell(0, cell).chars.length).eql(2);
|
||||||
expect(term.buffer.lines.get(1).get(1)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(1).loadCell(1, cell).chars).eql('');
|
||||||
term.reset();
|
term.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('2 characters per cell over line end without autowrap', () => {
|
it('2 characters per cell over line end without autowrap', () => {
|
||||||
const high = String.fromCharCode(0xD800);
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
||||||
term.buffer.x = term.cols - 1;
|
term.buffer.x = term.cols - 1;
|
||||||
term.wraparoundMode = false;
|
term.wraparoundMode = false;
|
||||||
term.write('a' + high + String.fromCharCode(i));
|
term.write('a' + high + String.fromCharCode(i));
|
||||||
// auto wraparound mode should cut off the rest of the line
|
// auto wraparound mode should cut off the rest of the line
|
||||||
expect(term.buffer.lines.get(0).get(term.cols - 1)[CHAR_DATA_CHAR_INDEX]).eql('a');
|
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).chars).eql('a');
|
||||||
expect(term.buffer.lines.get(0).get(term.cols - 1)[CHAR_DATA_CHAR_INDEX].length).eql(1);
|
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).chars.length).eql(1);
|
||||||
expect(term.buffer.lines.get(1).get(1)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(1).loadCell(1, cell).chars).eql('');
|
||||||
term.reset();
|
term.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('splitted surrogates', () => {
|
it('splitted surrogates', () => {
|
||||||
const high = String.fromCharCode(0xD800);
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
||||||
term.write(high);
|
term.write(high);
|
||||||
term.write(String.fromCharCode(i));
|
term.write(String.fromCharCode(i));
|
||||||
const tchar = term.buffer.lines.get(0).get(0);
|
const tchar = term.buffer.lines.get(0).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql(high + String.fromCharCode(i));
|
expect(tchar.chars).eql(high + String.fromCharCode(i));
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(tchar.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(tchar.width).eql(1);
|
||||||
expect(term.buffer.lines.get(0).get(1)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(0).loadCell(1, cell).chars).eql('');
|
||||||
term.reset();
|
term.reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('unicode - combining characters', () => {
|
describe('unicode - combining characters', () => {
|
||||||
|
const cell = new CellData();
|
||||||
it('café', () => {
|
it('café', () => {
|
||||||
term.write('cafe\u0301');
|
term.write('cafe\u0301');
|
||||||
expect(term.buffer.lines.get(0).get(3)[CHAR_DATA_CHAR_INDEX]).eql('e\u0301');
|
term.buffer.lines.get(0).loadCell(3, cell);
|
||||||
expect(term.buffer.lines.get(0).get(3)[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars).eql('e\u0301');
|
||||||
expect(term.buffer.lines.get(0).get(3)[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.chars.length).eql(2);
|
||||||
|
expect(cell.width).eql(1);
|
||||||
});
|
});
|
||||||
it('café - end of line', () => {
|
it('café - end of line', () => {
|
||||||
term.buffer.x = term.cols - 1 - 3;
|
term.buffer.x = term.cols - 1 - 3;
|
||||||
term.write('cafe\u0301');
|
term.write('cafe\u0301');
|
||||||
expect(term.buffer.lines.get(0).get(term.cols - 1)[CHAR_DATA_CHAR_INDEX]).eql('e\u0301');
|
term.buffer.lines.get(0).loadCell(term.cols - 1, cell);
|
||||||
expect(term.buffer.lines.get(0).get(term.cols - 1)[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars).eql('e\u0301');
|
||||||
expect(term.buffer.lines.get(0).get(term.cols - 1)[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(term.buffer.lines.get(0).get(1)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.width).eql(1);
|
||||||
expect(term.buffer.lines.get(0).get(1)[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
term.buffer.lines.get(0).loadCell(1, cell);
|
||||||
expect(term.buffer.lines.get(0).get(1)[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.chars).eql('');
|
||||||
|
expect(cell.chars.length).eql(0);
|
||||||
|
expect(cell.width).eql(1);
|
||||||
});
|
});
|
||||||
it('multiple combined é', () => {
|
it('multiple combined é', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.write(Array(100).join('e\u0301'));
|
term.write(Array(100).join('e\u0301'));
|
||||||
for (let i = 0; i < term.cols; ++i) {
|
for (let i = 0; i < term.cols; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('e\u0301');
|
expect(cell.chars).eql('e\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
}
|
}
|
||||||
const tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('e\u0301');
|
expect(cell.chars).eql('e\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
});
|
});
|
||||||
it('multiple surrogate with combined', () => {
|
it('multiple surrogate with combined', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.write(Array(100).join('\uD800\uDC00\u0301'));
|
term.write(Array(100).join('\uD800\uDC00\u0301'));
|
||||||
for (let i = 0; i < term.cols; ++i) {
|
for (let i = 0; i < term.cols; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('\uD800\uDC00\u0301');
|
expect(cell.chars).eql('\uD800\uDC00\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(3);
|
expect(cell.chars.length).eql(3);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
}
|
}
|
||||||
const tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('\uD800\uDC00\u0301');
|
expect(cell.chars).eql('\uD800\uDC00\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(3);
|
expect(cell.chars.length).eql(3);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('unicode - fullwidth characters', () => {
|
describe('unicode - fullwidth characters', () => {
|
||||||
|
const cell = new CellData();
|
||||||
it('cursor movement even', () => {
|
it('cursor movement even', () => {
|
||||||
expect(term.buffer.x).eql(0);
|
expect(term.buffer.x).eql(0);
|
||||||
term.write('¥');
|
term.write('¥');
|
||||||
@@ -896,140 +906,141 @@ describe('term.js addons', () => {
|
|||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.write(Array(50).join('¥'));
|
term.write(Array(50).join('¥'));
|
||||||
for (let i = 0; i < term.cols; ++i) {
|
for (let i = 0; i < term.cols; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(0);
|
expect(cell.width).eql(0);
|
||||||
} else {
|
} else {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(cell.chars).eql('¥');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(1);
|
expect(cell.chars.length).eql(1);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(cell.chars).eql('¥');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(1);
|
expect(cell.chars.length).eql(1);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
});
|
});
|
||||||
it('line of ¥ odd', () => {
|
it('line of ¥ odd', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.buffer.x = 1;
|
term.buffer.x = 1;
|
||||||
term.write(Array(50).join('¥'));
|
term.write(Array(50).join('¥'));
|
||||||
for (let i = 1; i < term.cols - 1; ++i) {
|
for (let i = 1; i < term.cols - 1; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
if (!(i % 2)) {
|
if (!(i % 2)) {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(0);
|
expect(cell.width).eql(0);
|
||||||
} else {
|
} else {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(cell.chars).eql('¥');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(1);
|
expect(cell.chars.length).eql(1);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let tchar = term.buffer.lines.get(0).get(term.cols - 1);
|
term.buffer.lines.get(0).loadCell(term.cols - 1, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(cell.chars).eql('¥');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(1);
|
expect(cell.chars.length).eql(1);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
});
|
});
|
||||||
it('line of ¥ with combining odd', () => {
|
it('line of ¥ with combining odd', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.buffer.x = 1;
|
term.buffer.x = 1;
|
||||||
term.write(Array(50).join('¥\u0301'));
|
term.write(Array(50).join('¥\u0301'));
|
||||||
for (let i = 1; i < term.cols - 1; ++i) {
|
for (let i = 1; i < term.cols - 1; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
if (!(i % 2)) {
|
if (!(i % 2)) {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(0);
|
expect(cell.width).eql(0);
|
||||||
} else {
|
} else {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥\u0301');
|
expect(cell.chars).eql('¥\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let tchar = term.buffer.lines.get(0).get(term.cols - 1);
|
term.buffer.lines.get(0).loadCell(term.cols - 1, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥\u0301');
|
expect(cell.chars).eql('¥\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
});
|
});
|
||||||
it('line of ¥ with combining even', () => {
|
it('line of ¥ with combining even', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.write(Array(50).join('¥\u0301'));
|
term.write(Array(50).join('¥\u0301'));
|
||||||
for (let i = 0; i < term.cols; ++i) {
|
for (let i = 0; i < term.cols; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(0);
|
expect(cell.width).eql(0);
|
||||||
} else {
|
} else {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥\u0301');
|
expect(cell.chars).eql('¥\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('¥\u0301');
|
expect(cell.chars).eql('¥\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(2);
|
expect(cell.chars.length).eql(2);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
});
|
});
|
||||||
it('line of surrogate fullwidth with combining odd', () => {
|
it('line of surrogate fullwidth with combining odd', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.buffer.x = 1;
|
term.buffer.x = 1;
|
||||||
term.write(Array(50).join('\ud843\ude6d\u0301'));
|
term.write(Array(50).join('\ud843\ude6d\u0301'));
|
||||||
for (let i = 1; i < term.cols - 1; ++i) {
|
for (let i = 1; i < term.cols - 1; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
if (!(i % 2)) {
|
if (!(i % 2)) {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(0);
|
expect(cell.width).eql(0);
|
||||||
} else {
|
} else {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('\ud843\ude6d\u0301');
|
expect(cell.chars).eql('\ud843\ude6d\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(3);
|
expect(cell.chars.length).eql(3);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let tchar = term.buffer.lines.get(0).get(term.cols - 1);
|
term.buffer.lines.get(0).loadCell(term.cols - 1, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(1);
|
expect(cell.width).eql(1);
|
||||||
tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('\ud843\ude6d\u0301');
|
expect(cell.chars).eql('\ud843\ude6d\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(3);
|
expect(cell.chars.length).eql(3);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
});
|
});
|
||||||
it('line of surrogate fullwidth with combining even', () => {
|
it('line of surrogate fullwidth with combining even', () => {
|
||||||
term.wraparoundMode = true;
|
term.wraparoundMode = true;
|
||||||
term.write(Array(50).join('\ud843\ude6d\u0301'));
|
term.write(Array(50).join('\ud843\ude6d\u0301'));
|
||||||
for (let i = 0; i < term.cols; ++i) {
|
for (let i = 0; i < term.cols; ++i) {
|
||||||
const tchar = term.buffer.lines.get(0).get(i);
|
term.buffer.lines.get(0).loadCell(i, cell);
|
||||||
if (i % 2) {
|
if (i % 2) {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(cell.chars).eql('');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(0);
|
expect(cell.chars.length).eql(0);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(0);
|
expect(cell.width).eql(0);
|
||||||
} else {
|
} else {
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('\ud843\ude6d\u0301');
|
expect(cell.chars).eql('\ud843\ude6d\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(3);
|
expect(cell.chars.length).eql(3);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tchar = term.buffer.lines.get(1).get(0);
|
term.buffer.lines.get(1).loadCell(0, cell);
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX]).eql('\ud843\ude6d\u0301');
|
expect(cell.chars).eql('\ud843\ude6d\u0301');
|
||||||
expect(tchar[CHAR_DATA_CHAR_INDEX].length).eql(3);
|
expect(cell.chars.length).eql(3);
|
||||||
expect(tchar[CHAR_DATA_WIDTH_INDEX]).eql(2);
|
expect(cell.width).eql(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('insert mode', () => {
|
describe('insert mode', () => {
|
||||||
|
const cell = new CellData();
|
||||||
it('halfwidth - all', () => {
|
it('halfwidth - all', () => {
|
||||||
term.write(Array(9).join('0123456789').slice(-80));
|
term.write(Array(9).join('0123456789').slice(-80));
|
||||||
term.buffer.x = 10;
|
term.buffer.x = 10;
|
||||||
@@ -1037,10 +1048,10 @@ describe('term.js addons', () => {
|
|||||||
term.insertMode = true;
|
term.insertMode = true;
|
||||||
term.write('abcde');
|
term.write('abcde');
|
||||||
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
||||||
expect(term.buffer.lines.get(0).get(10)[CHAR_DATA_CHAR_INDEX]).eql('a');
|
expect(term.buffer.lines.get(0).loadCell(10, cell).chars).eql('a');
|
||||||
expect(term.buffer.lines.get(0).get(14)[CHAR_DATA_CHAR_INDEX]).eql('e');
|
expect(term.buffer.lines.get(0).loadCell(14, cell).chars).eql('e');
|
||||||
expect(term.buffer.lines.get(0).get(15)[CHAR_DATA_CHAR_INDEX]).eql('0');
|
expect(term.buffer.lines.get(0).loadCell(15, cell).chars).eql('0');
|
||||||
expect(term.buffer.lines.get(0).get(79)[CHAR_DATA_CHAR_INDEX]).eql('4');
|
expect(term.buffer.lines.get(0).loadCell(79, cell).chars).eql('4');
|
||||||
});
|
});
|
||||||
it('fullwidth - insert', () => {
|
it('fullwidth - insert', () => {
|
||||||
term.write(Array(9).join('0123456789').slice(-80));
|
term.write(Array(9).join('0123456789').slice(-80));
|
||||||
@@ -1049,11 +1060,11 @@ describe('term.js addons', () => {
|
|||||||
term.insertMode = true;
|
term.insertMode = true;
|
||||||
term.write('¥¥¥');
|
term.write('¥¥¥');
|
||||||
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
||||||
expect(term.buffer.lines.get(0).get(10)[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(term.buffer.lines.get(0).loadCell(10, cell).chars).eql('¥');
|
||||||
expect(term.buffer.lines.get(0).get(11)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(0).loadCell(11, cell).chars).eql('');
|
||||||
expect(term.buffer.lines.get(0).get(14)[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(term.buffer.lines.get(0).loadCell(14, cell).chars).eql('¥');
|
||||||
expect(term.buffer.lines.get(0).get(15)[CHAR_DATA_CHAR_INDEX]).eql('');
|
expect(term.buffer.lines.get(0).loadCell(15, cell).chars).eql('');
|
||||||
expect(term.buffer.lines.get(0).get(79)[CHAR_DATA_CHAR_INDEX]).eql('3');
|
expect(term.buffer.lines.get(0).loadCell(79, cell).chars).eql('3');
|
||||||
});
|
});
|
||||||
it('fullwidth - right border', () => {
|
it('fullwidth - right border', () => {
|
||||||
term.write(Array(41).join('¥'));
|
term.write(Array(41).join('¥'));
|
||||||
@@ -1062,14 +1073,14 @@ describe('term.js addons', () => {
|
|||||||
term.insertMode = true;
|
term.insertMode = true;
|
||||||
term.write('a');
|
term.write('a');
|
||||||
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
||||||
expect(term.buffer.lines.get(0).get(10)[CHAR_DATA_CHAR_INDEX]).eql('a');
|
expect(term.buffer.lines.get(0).loadCell(10, cell).chars).eql('a');
|
||||||
expect(term.buffer.lines.get(0).get(11)[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(term.buffer.lines.get(0).loadCell(11, cell).chars).eql('¥');
|
||||||
expect(term.buffer.lines.get(0).get(79)[CHAR_DATA_CHAR_INDEX]).eql(''); // fullwidth char got replaced
|
expect(term.buffer.lines.get(0).loadCell(79, cell).chars).eql(''); // fullwidth char got replaced
|
||||||
term.write('b');
|
term.write('b');
|
||||||
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
expect(term.buffer.lines.get(0).length).eql(term.cols);
|
||||||
expect(term.buffer.lines.get(0).get(11)[CHAR_DATA_CHAR_INDEX]).eql('b');
|
expect(term.buffer.lines.get(0).loadCell(11, cell).chars).eql('b');
|
||||||
expect(term.buffer.lines.get(0).get(12)[CHAR_DATA_CHAR_INDEX]).eql('¥');
|
expect(term.buffer.lines.get(0).loadCell(12, cell).chars).eql('¥');
|
||||||
expect(term.buffer.lines.get(0).get(79)[CHAR_DATA_CHAR_INDEX]).eql(''); // empty cell after fullwidth
|
expect(term.buffer.lines.get(0).loadCell(79, cell).chars).eql(''); // empty cell after fullwidth
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -524,6 +524,7 @@ export interface ICellData {
|
|||||||
chars: string;
|
chars: string;
|
||||||
code: number;
|
code: number;
|
||||||
setFromCharData(value: CharData): void;
|
setFromCharData(value: CharData): void;
|
||||||
|
asCharData: CharData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ describe('CharacterJoinerRegistry', () => {
|
|||||||
let sub = lineData([['deemo']]);
|
let sub = lineData([['deemo']]);
|
||||||
let oldSize = line6.length;
|
let oldSize = line6.length;
|
||||||
line6.resize(oldSize + sub.length, CellData.fromCharData([0, '', 0, 0]));
|
line6.resize(oldSize + sub.length, CellData.fromCharData([0, '', 0, 0]));
|
||||||
for (let i = 0; i < sub.length; ++i) line6.setCell(i + oldSize, CellData.fromCharData(sub.get(i)));
|
for (let i = 0; i < sub.length; ++i) line6.setCell(i + oldSize, sub.loadCell(i, new CellData()));
|
||||||
line6.resize(line6.length + 1, CellData.fromCharData([0, '\xf0\x9f\x98\x81', 1, 128513]));
|
line6.resize(line6.length + 1, CellData.fromCharData([0, '\xf0\x9f\x98\x81', 1, 128513]));
|
||||||
line6.resize(line6.length + 1, CellData.fromCharData([0, ' ', 1, ' '.charCodeAt(0)]));
|
line6.resize(line6.length + 1, CellData.fromCharData([0, ' ', 1, ' '.charCodeAt(0)]));
|
||||||
sub = lineData([['jiabc']]);
|
sub = lineData([['jiabc']]);
|
||||||
oldSize = line6.length;
|
oldSize = line6.length;
|
||||||
line6.resize(oldSize + sub.length, CellData.fromCharData([0, '', 0, 0]));
|
line6.resize(oldSize + sub.length, CellData.fromCharData([0, '', 0, 0]));
|
||||||
for (let i = 0; i < sub.length; ++i) line6.setCell(i + oldSize, CellData.fromCharData(sub.get(i)));
|
for (let i = 0; i < sub.length; ++i) line6.setCell(i + oldSize, sub.loadCell(i, new CellData()));
|
||||||
lines.set(6, line6);
|
lines.set(6, line6);
|
||||||
|
|
||||||
(<MockBuffer>terminal.buffer).setLines(lines);
|
(<MockBuffer>terminal.buffer).setLines(lines);
|
||||||
|
|||||||
Reference in New Issue
Block a user