Skip to content

Commit f6fbf63

Browse files
committed
Add windowsPty unit test
1 parent 3e5c6a1 commit f6fbf63

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/browser/Terminal.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,47 @@ describe('Terminal', () => {
10411041
});
10421042
});
10431043

1044+
describe('Windows Pty', () => {
1045+
it('should mark lines as wrapped when the line ends in a non-null character after a LF', async () => {
1046+
const data = [
1047+
'aaaaaaaaaa\n\r', // cannot wrap as it's the first
1048+
'aaaaaaaaa\n\r', // wrapped (windows mode only)
1049+
'aaaaaaaaa' // not wrapped
1050+
];
1051+
1052+
const normalTerminal = new TestTerminal({ rows: 5, cols: 10, windowsPty: {} });
1053+
await normalTerminal.writeP(data.join(''));
1054+
assert.equal(normalTerminal.buffer.lines.get(0)!.isWrapped, false);
1055+
assert.equal(normalTerminal.buffer.lines.get(1)!.isWrapped, false);
1056+
assert.equal(normalTerminal.buffer.lines.get(2)!.isWrapped, false);
1057+
1058+
const windowsModeTerminal = new TestTerminal({ rows: 5, cols: 10, windowsPty: { backend: 'conpty', buildNumber: 19000 } });
1059+
await windowsModeTerminal.writeP(data.join(''));
1060+
assert.equal(windowsModeTerminal.buffer.lines.get(0)!.isWrapped, false);
1061+
assert.equal(windowsModeTerminal.buffer.lines.get(1)!.isWrapped, true, 'This line should wrap in Windows mode as the previous line ends in a non-null character');
1062+
assert.equal(windowsModeTerminal.buffer.lines.get(2)!.isWrapped, false);
1063+
});
1064+
1065+
it('should mark lines as wrapped when the line ends in a non-null character after a CUP', async () => {
1066+
const data = [
1067+
'aaaaaaaaaa\x1b[2;1H', // cannot wrap as it's the first
1068+
'aaaaaaaaa\x1b[3;1H', // wrapped (windows mode only)
1069+
'aaaaaaaaa' // not wrapped
1070+
];
1071+
1072+
const normalTerminal = new TestTerminal({ rows: 5, cols: 10, windowsPty: {} });
1073+
await normalTerminal.writeP(data.join(''));
1074+
assert.equal(normalTerminal.buffer.lines.get(0)!.isWrapped, false);
1075+
assert.equal(normalTerminal.buffer.lines.get(1)!.isWrapped, false);
1076+
assert.equal(normalTerminal.buffer.lines.get(2)!.isWrapped, false);
1077+
1078+
const windowsModeTerminal = new TestTerminal({ rows: 5, cols: 10, windowsPty: { backend: 'conpty', buildNumber: 19000 } });
1079+
await windowsModeTerminal.writeP(data.join(''));
1080+
assert.equal(windowsModeTerminal.buffer.lines.get(0)!.isWrapped, false);
1081+
assert.equal(windowsModeTerminal.buffer.lines.get(1)!.isWrapped, true, 'This line should wrap in Windows mode as the previous line ends in a non-null character');
1082+
assert.equal(windowsModeTerminal.buffer.lines.get(2)!.isWrapped, false);
1083+
});
1084+
});
10441085
describe('Windows Mode', () => {
10451086
it('should mark lines as wrapped when the line ends in a non-null character after a LF', async () => {
10461087
const data = [

0 commit comments

Comments
 (0)