mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge branch 'master' into 1737_inverse_dynamic_cache
This commit is contained in:
@@ -133,4 +133,31 @@ describe('BufferLine', function(): void {
|
||||
const line3 = line.clone();
|
||||
chai.expect(TestBufferLine.prototype.toArray.apply(line3)).eql(line.toArray());
|
||||
});
|
||||
it('resize enlarge', function(): void {
|
||||
const line = new TestBufferLine(5, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(10, [1, 'a', 0, 'a'.charCodeAt(0)]);
|
||||
chai.expect(line.toArray()).eql(Array(10).fill([1, 'a', 0, 'a'.charCodeAt(0)]));
|
||||
});
|
||||
it('resize shrink(true)', function(): void {
|
||||
const line = new TestBufferLine(10, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(5, [1, 'a', 0, 'a'.charCodeAt(0)], true);
|
||||
chai.expect(line.toArray()).eql(Array(5).fill([1, 'a', 0, 'a'.charCodeAt(0)]));
|
||||
});
|
||||
it('resize shrink(false)', function(): void {
|
||||
const line = new TestBufferLine(10, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(5, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
chai.expect(line.toArray()).eql(Array(5).fill([1, 'a', 0, 'a'.charCodeAt(0)]));
|
||||
});
|
||||
it('resize shrink(false) + shrink(false)', function(): void {
|
||||
const line = new TestBufferLine(20, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(10, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(5, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
chai.expect(line.toArray()).eql(Array(5).fill([1, 'a', 0, 'a'.charCodeAt(0)]));
|
||||
});
|
||||
it('resize shrink(false) + enlarge', function(): void {
|
||||
const line = new TestBufferLine(20, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(10, [1, 'a', 0, 'a'.charCodeAt(0)], false);
|
||||
line.resize(15, [1, 'a', 0, 'a'.charCodeAt(0)]);
|
||||
chai.expect(line.toArray()).eql(Array(15).fill([1, 'a', 0, 'a'.charCodeAt(0)]));
|
||||
});
|
||||
});
|
||||
|
||||
+5
-1
@@ -218,7 +218,11 @@ export class BufferLineTypedArray implements IBufferLine {
|
||||
if (cols > this.length) {
|
||||
const data = new Uint32Array(cols * CELL_SIZE);
|
||||
if (this._data) {
|
||||
data.set(this._data);
|
||||
if (cols * CELL_SIZE < this._data.length) {
|
||||
data.set(this._data.subarray(0, cols * CELL_SIZE));
|
||||
} else {
|
||||
data.set(this._data);
|
||||
}
|
||||
}
|
||||
this._data = data;
|
||||
for (let i = this.length; i < cols; ++i) {
|
||||
|
||||
@@ -469,4 +469,11 @@ describe('InputHandler', () => {
|
||||
}
|
||||
expect(s).equals('World ');
|
||||
});
|
||||
describe('print', () => {
|
||||
it('should not cause an infinite loop (regression test)', () => {
|
||||
const term = new Terminal();
|
||||
const inputHandler = new InputHandler(term);
|
||||
inputHandler.print(String.fromCharCode(0x200B), 0, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+4
-2
@@ -452,8 +452,10 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
// fullwidth char - also set next cell to placeholder stub and advance cursor
|
||||
// for graphemes bigger than fullwidth we can simply loop to zero
|
||||
// we already made sure above, that buffer.x + chWidth will not overflow right
|
||||
while (--chWidth) {
|
||||
bufferRow.set(buffer.x++, [curAttr, '', 0, undefined]);
|
||||
if (chWidth > 0) {
|
||||
while (--chWidth) {
|
||||
bufferRow.set(buffer.x++, [curAttr, '', 0, undefined]);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._terminal.updateRange(buffer.y);
|
||||
|
||||
Reference in New Issue
Block a user