Merge branch 'master' into extract_vt_features
This commit is contained in:
@@ -1359,6 +1359,48 @@ describe('Terminal', () => {
|
|||||||
}).to.not.throw();
|
}).to.not.throw();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Windows Mode', () => {
|
||||||
|
it('should mark lines as wrapped when the line ends in a non-null character after a LF', () => {
|
||||||
|
const data = [
|
||||||
|
'aaaaaaaaaa\n\r', // cannot wrap as it's the first
|
||||||
|
'aaaaaaaaa\n\r', // wrapped (windows mode only)
|
||||||
|
'aaaaaaaaa' // not wrapped
|
||||||
|
];
|
||||||
|
|
||||||
|
const normalTerminal = new TestTerminal({rows: 5, cols: 10, windowsMode: false});
|
||||||
|
normalTerminal.writeSync(data.join(''));
|
||||||
|
assert.equal(normalTerminal.buffer.lines.get(0).isWrapped, false);
|
||||||
|
assert.equal(normalTerminal.buffer.lines.get(1).isWrapped, false);
|
||||||
|
assert.equal(normalTerminal.buffer.lines.get(2).isWrapped, false);
|
||||||
|
|
||||||
|
const windowsModeTerminal = new TestTerminal({rows: 5, cols: 10, windowsMode: true});
|
||||||
|
windowsModeTerminal.writeSync(data.join(''));
|
||||||
|
assert.equal(windowsModeTerminal.buffer.lines.get(0).isWrapped, false);
|
||||||
|
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');
|
||||||
|
assert.equal(windowsModeTerminal.buffer.lines.get(2).isWrapped, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should mark lines as wrapped when the line ends in a non-null character after a CUP', () => {
|
||||||
|
const data = [
|
||||||
|
'aaaaaaaaaa\x1b[2;1H', // cannot wrap as it's the first
|
||||||
|
'aaaaaaaaa\x1b[3;1H', // wrapped (windows mode only)
|
||||||
|
'aaaaaaaaa' // not wrapped
|
||||||
|
];
|
||||||
|
|
||||||
|
const normalTerminal = new TestTerminal({rows: 5, cols: 10, windowsMode: false});
|
||||||
|
normalTerminal.writeSync(data.join(''));
|
||||||
|
assert.equal(normalTerminal.buffer.lines.get(0).isWrapped, false);
|
||||||
|
assert.equal(normalTerminal.buffer.lines.get(1).isWrapped, false);
|
||||||
|
assert.equal(normalTerminal.buffer.lines.get(2).isWrapped, false);
|
||||||
|
|
||||||
|
const windowsModeTerminal = new TestTerminal({rows: 5, cols: 10, windowsMode: true});
|
||||||
|
windowsModeTerminal.writeSync(data.join(''));
|
||||||
|
assert.equal(windowsModeTerminal.buffer.lines.get(0).isWrapped, false);
|
||||||
|
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');
|
||||||
|
assert.equal(windowsModeTerminal.buffer.lines.get(2).isWrapped, false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
class TestLinkifier extends Linkifier {
|
class TestLinkifier extends Linkifier {
|
||||||
|
|||||||
+12
-2
@@ -43,7 +43,7 @@ import { IKeyboardEvent, KeyboardResultType, IBufferLine, IAttributeData, CoreMo
|
|||||||
import { evaluateKeyboardEvent } from 'common/input/Keyboard';
|
import { evaluateKeyboardEvent } from 'common/input/Keyboard';
|
||||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||||
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
|
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
|
||||||
import { handleWindowsModeLineFeed } from 'common/WindowsMode';
|
import { updateWindowsModeWrappedState } from 'common/WindowsMode';
|
||||||
import { ColorManager } from 'browser/ColorManager';
|
import { ColorManager } from 'browser/ColorManager';
|
||||||
import { RenderService } from 'browser/services/RenderService';
|
import { RenderService } from 'browser/services/RenderService';
|
||||||
import { IOptionsService, IBufferService, ICoreMouseService, ICoreService, ILogService, IDirtyRowService, IInstantiationService, ICharsetService } from 'common/services/Services';
|
import { IOptionsService, IBufferService, ICoreMouseService, ICoreService, ILogService, IDirtyRowService, IInstantiationService, ICharsetService } from 'common/services/Services';
|
||||||
@@ -264,7 +264,17 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
|||||||
|
|
||||||
private _enableWindowsMode(): void {
|
private _enableWindowsMode(): void {
|
||||||
if (!this._windowsMode) {
|
if (!this._windowsMode) {
|
||||||
this._windowsMode = this.onLineFeed(handleWindowsModeLineFeed.bind(null, this._bufferService));
|
const disposables: IDisposable[] = [];
|
||||||
|
disposables.push(this.onLineFeed(updateWindowsModeWrappedState.bind(null, this._bufferService)));
|
||||||
|
disposables.push(this.addCsiHandler({ final: 'H' }, () => {
|
||||||
|
updateWindowsModeWrappedState(this._bufferService);
|
||||||
|
return false;
|
||||||
|
}));
|
||||||
|
this._windowsMode = {
|
||||||
|
dispose: () => {
|
||||||
|
disposables.forEach(d => d.dispose());
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';
|
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/Constants';
|
||||||
import { IBufferService } from 'common/services/Services';
|
import { IBufferService } from 'common/services/Services';
|
||||||
|
|
||||||
export function handleWindowsModeLineFeed(bufferService: IBufferService): void {
|
export function updateWindowsModeWrappedState(bufferService: IBufferService): void {
|
||||||
// Winpty does not support wraparound mode which means that lines will never
|
// Winpty does not support wraparound mode which means that lines will never
|
||||||
// be marked as wrapped. This causes issues for things like copying a line
|
// be marked as wrapped. This causes issues for things like copying a line
|
||||||
// retaining the wrapped new line characters or if consumers are listening
|
// retaining the wrapped new line characters or if consumers are listening
|
||||||
|
|||||||
Reference in New Issue
Block a user