Merge branch 'master' into perf_fixes
This commit is contained in:
@@ -108,7 +108,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
for (const l of this._renderLayers) {
|
for (const l of this._renderLayers) {
|
||||||
l.dispose();
|
l.dispose();
|
||||||
}
|
}
|
||||||
this._core.screenElement!.removeChild(this._canvas);
|
this._canvas.parentElement?.removeChild(this._canvas);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -732,80 +732,78 @@ describe('Terminal', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('unicode - surrogates', () => {
|
describe('unicode - surrogates', () => {
|
||||||
it('2 characters per cell', async function (): Promise<void> {
|
for (let i = 0xDC00; i <= 0xDCF0; i += 0x10) {
|
||||||
this.timeout(10000); // This is needed because istanbul patches code and slows it down
|
const range = `0x${i.toString(16).toUpperCase()}-0x${(i + 0xF).toString(16).toUpperCase()}`;
|
||||||
const high = String.fromCharCode(0xD800);
|
it(`${range}: 2 characters per cell`, async function (): Promise<void> {
|
||||||
const cell = new CellData();
|
const high = String.fromCharCode(0xD800);
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
const cell = new CellData();
|
||||||
await term.writeP(high + String.fromCharCode(i));
|
for (let j = i; j <= i + 0xF; j++) {
|
||||||
const tchar = term.buffer.lines.get(0)!.loadCell(0, cell);
|
await term.writeP(high + String.fromCharCode(j));
|
||||||
assert.equal(tchar.getChars(), high + String.fromCharCode(i));
|
const tchar = term.buffer.lines.get(0)!.loadCell(0, cell);
|
||||||
assert.equal(tchar.getChars().length, 2);
|
assert.equal(tchar.getChars(), high + String.fromCharCode(j));
|
||||||
assert.equal(tchar.getWidth(), 1);
|
assert.equal(tchar.getChars().length, 2);
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(1, cell).getChars(), '');
|
assert.equal(tchar.getWidth(), 1);
|
||||||
term.reset();
|
assert.equal(term.buffer.lines.get(0)!.loadCell(1, cell).getChars(), '');
|
||||||
}
|
term.reset();
|
||||||
});
|
|
||||||
it('2 characters at last cell', async () => {
|
|
||||||
const high = String.fromCharCode(0xD800);
|
|
||||||
const cell = new CellData();
|
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
|
||||||
term.buffer.x = term.cols - 1;
|
|
||||||
await term.writeP(high + String.fromCharCode(i));
|
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(term.buffer.x - 1, cell).getChars(), high + String.fromCharCode(i));
|
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(term.buffer.x - 1, cell).getChars().length, 2);
|
|
||||||
assert.equal(term.buffer.lines.get(1)!.loadCell(0, cell).getChars(), '');
|
|
||||||
term.reset();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
it('2 characters per cell over line end with autowrap', async function (): Promise<void> {
|
|
||||||
this.timeout(10000);
|
|
||||||
const high = String.fromCharCode(0xD800);
|
|
||||||
const cell = new CellData();
|
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
|
||||||
term.buffer.x = term.cols - 1;
|
|
||||||
|
|
||||||
await term.writeP('a' + high + String.fromCharCode(i));
|
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(term.cols - 1, cell).getChars(), 'a');
|
|
||||||
assert.equal(term.buffer.lines.get(1)!.loadCell(0, cell).getChars(), high + String.fromCharCode(i));
|
|
||||||
assert.equal(term.buffer.lines.get(1)!.loadCell(0, cell).getChars().length, 2);
|
|
||||||
assert.equal(term.buffer.lines.get(1)!.loadCell(1, cell).getChars(), '');
|
|
||||||
term.reset();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
it('2 characters per cell over line end without autowrap', async function (): Promise<void> {
|
|
||||||
this.timeout(10000);
|
|
||||||
const high = String.fromCharCode(0xD800);
|
|
||||||
const cell = new CellData();
|
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
|
||||||
term.buffer.x = term.cols - 1;
|
|
||||||
await term.writeP('\x1b[?7l'); // Disable wraparound mode
|
|
||||||
const width = wcwidth((0xD800 - 0xD800) * 0x400 + i - 0xDC00 + 0x10000);
|
|
||||||
if (width !== 1) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
await term.writeP('a' + high + String.fromCharCode(i));
|
});
|
||||||
// auto wraparound mode should cut off the rest of the line
|
it(`${range}: 2 characters at last cell`, async () => {
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(term.cols - 1, cell).getChars(), high + String.fromCharCode(i));
|
const high = String.fromCharCode(0xD800);
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(term.cols - 1, cell).getChars().length, 2);
|
const cell = new CellData();
|
||||||
assert.equal(term.buffer.lines.get(1)!.loadCell(1, cell).getChars(), '');
|
term.buffer.x = term.cols - 1;
|
||||||
term.reset();
|
for (let j = i; j <= i + 0xF; j++) {
|
||||||
}
|
await term.writeP(high + String.fromCharCode(j));
|
||||||
});
|
assert.equal(term.buffer.lines.get(0)!.loadCell(term.buffer.x - 1, cell).getChars(), high + String.fromCharCode(j));
|
||||||
it('splitted surrogates', async function (): Promise<void> {
|
assert.equal(term.buffer.lines.get(0)!.loadCell(term.buffer.x - 1, cell).getChars().length, 2);
|
||||||
this.timeout(10000);
|
assert.equal(term.buffer.lines.get(1)!.loadCell(0, cell).getChars(), '');
|
||||||
const high = String.fromCharCode(0xD800);
|
term.reset();
|
||||||
const cell = new CellData();
|
}
|
||||||
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
|
});
|
||||||
await term.writeP(high + String.fromCharCode(i));
|
it(`${range}: 2 characters per cell over line end with autowrap`, async function (): Promise<void> {
|
||||||
const tchar = term.buffer.lines.get(0)!.loadCell(0, cell);
|
const high = String.fromCharCode(0xD800);
|
||||||
assert.equal(tchar.getChars(), high + String.fromCharCode(i));
|
const cell = new CellData();
|
||||||
assert.equal(tchar.getChars().length, 2);
|
for (let j = i; j <= i + 0xF; j++) {
|
||||||
assert.equal(tchar.getWidth(), 1);
|
term.buffer.x = term.cols - 1;
|
||||||
assert.equal(term.buffer.lines.get(0)!.loadCell(1, cell).getChars(), '');
|
await term.writeP('a' + high + String.fromCharCode(j));
|
||||||
term.reset();
|
assert.equal(term.buffer.lines.get(0)!.loadCell(term.cols - 1, cell).getChars(), 'a');
|
||||||
}
|
assert.equal(term.buffer.lines.get(1)!.loadCell(0, cell).getChars(), high + String.fromCharCode(j));
|
||||||
});
|
assert.equal(term.buffer.lines.get(1)!.loadCell(0, cell).getChars().length, 2);
|
||||||
|
assert.equal(term.buffer.lines.get(1)!.loadCell(1, cell).getChars(), '');
|
||||||
|
term.reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
it(`${range}: 2 characters per cell over line end without autowrap`, async function (): Promise<void> {
|
||||||
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
|
for (let j = i; j <= i + 0xF; j++) {
|
||||||
|
term.buffer.x = term.cols - 1;
|
||||||
|
await term.writeP('\x1b[?7l'); // Disable wraparound mode
|
||||||
|
const width = wcwidth((0xD800 - 0xD800) * 0x400 + j - 0xDC00 + 0x10000);
|
||||||
|
if (width !== 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
await term.writeP('a' + high + String.fromCharCode(j));
|
||||||
|
// auto wraparound mode should cut off the rest of the line
|
||||||
|
assert.equal(term.buffer.lines.get(0)!.loadCell(term.cols - 1, cell).getChars(), high + String.fromCharCode(j));
|
||||||
|
assert.equal(term.buffer.lines.get(0)!.loadCell(term.cols - 1, cell).getChars().length, 2);
|
||||||
|
assert.equal(term.buffer.lines.get(1)!.loadCell(1, cell).getChars(), '');
|
||||||
|
term.reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
it(`${range}: splitted surrogates`, async function (): Promise<void> {
|
||||||
|
const high = String.fromCharCode(0xD800);
|
||||||
|
const cell = new CellData();
|
||||||
|
for (let j = i; j <= i + 0xF; j++) {
|
||||||
|
await term.writeP(high + String.fromCharCode(j));
|
||||||
|
const tchar = term.buffer.lines.get(0)!.loadCell(0, cell);
|
||||||
|
assert.equal(tchar.getChars(), high + String.fromCharCode(j));
|
||||||
|
assert.equal(tchar.getChars().length, 2);
|
||||||
|
assert.equal(tchar.getWidth(), 1);
|
||||||
|
assert.equal(term.buffer.lines.get(0)!.loadCell(1, cell).getChars(), '');
|
||||||
|
term.reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('unicode - combining characters', () => {
|
describe('unicode - combining characters', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user