fix no wraparound mode

This commit is contained in:
Jörg Breitbart
2019-07-05 00:56:57 +02:00
parent 82ff113107
commit 44035d14ab
3 changed files with 10 additions and 5 deletions
@@ -2,7 +2,7 @@
efgh
-------- set: wraparound ----------------------------------------------abcd
efgh
-------- unset: no wraparound -------------------------------------------abcd
-------- unset: no wraparound -------------------------------------------abch
this should be immediately below "no wraparound"
+2 -2
View File
@@ -431,12 +431,12 @@ export class InputHandler extends Disposable implements IInputHandler {
// row changed, get it again
bufferRow = buffer.lines.get(buffer.y + buffer.ybase);
} else {
buffer.x = cols - 1;
if (chWidth === 2) {
// FIXME: check for xterm behavior
// What to do here? We got a wide char that does not fit into last cell
continue;
}
// FIXME: Do we have to set buffer.x to cols - 1, if not wrapping?
}
}
@@ -2119,7 +2119,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this.cursorPosition([1, 1]);
for (let yOffset = 0; yOffset < this._terminal.rows; ++yOffset) {
let row = buffer.y + buffer.ybase + yOffset;
const row = buffer.y + buffer.ybase + yOffset;
buffer.lines.get(row).fill(cell);
buffer.lines.get(row).isWrapped = false;
}
+7 -2
View File
@@ -8,6 +8,7 @@ import { Terminal } from './Terminal';
import { MockViewport, MockCompositionHelper, MockRenderer } from './TestUtils.test';
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { CellData } from 'common/buffer/CellData';
import { wcwidth } from 'common/CharWidth';
const INIT_COLS = 80;
const INIT_ROWS = 24;
@@ -750,10 +751,14 @@ describe('Terminal', () => {
for (let i = 0xDC00; i <= 0xDCFF; ++i) {
term.buffer.x = term.cols - 1;
term.wraparoundMode = false;
const width = wcwidth((0xD800 - 0xD800) * 0x400 + i - 0xDC00 + 0x10000);
if (width !== 1) {
continue;
}
term.write('a' + high + String.fromCharCode(i));
// auto wraparound mode should cut off the rest of the line
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).getChars()).eql('a');
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).getChars().length).eql(1);
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).getChars()).eql(high + String.fromCharCode(i));
expect(term.buffer.lines.get(0).loadCell(term.cols - 1, cell).getChars().length).eql(2);
expect(term.buffer.lines.get(1).loadCell(1, cell).getChars()).eql('');
term.reset();
}