Merge branch 'master' into reverse_wraparound
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm-addon-search",
|
"name": "xterm-addon-search",
|
||||||
"version": "0.5.0",
|
"version": "0.6.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "The xterm.js authors",
|
"name": "The xterm.js authors",
|
||||||
"url": "https://xtermjs.org/"
|
"url": "https://xtermjs.org/"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm-addon-serialize",
|
"name": "xterm-addon-serialize",
|
||||||
"version": "0.1.2",
|
"version": "0.2.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "The xterm.js authors",
|
"name": "The xterm.js authors",
|
||||||
"url": "https://xtermjs.org/"
|
"url": "https://xtermjs.org/"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm-addon-web-links",
|
"name": "xterm-addon-web-links",
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "The xterm.js authors",
|
"name": "The xterm.js authors",
|
||||||
"url": "https://xtermjs.org/"
|
"url": "https://xtermjs.org/"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ILinkProvider, IBufferCellPosition, ILink, Terminal, IBuffer } from 'xterm';
|
import { ILinkProvider, IBufferCellPosition, ILink, Terminal } from 'xterm';
|
||||||
|
|
||||||
export class WebLinkProvider implements ILinkProvider {
|
export class WebLinkProvider implements ILinkProvider {
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Terminal, ILinkMatcherOptions, ITerminalAddon, ILinkProvider, IDisposable } from 'xterm';
|
import { Terminal, ILinkMatcherOptions, ITerminalAddon, IDisposable } from 'xterm';
|
||||||
import { WebLinkProvider } from './WebLinkProvider';
|
import { WebLinkProvider } from './WebLinkProvider';
|
||||||
|
|
||||||
const protocolClause = '(https?:\\/\\/)';
|
const protocolClause = '(https?:\\/\\/)';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm-addon-webgl",
|
"name": "xterm-addon-webgl",
|
||||||
"version": "0.5.1",
|
"version": "0.6.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "The xterm.js authors",
|
"name": "The xterm.js authors",
|
||||||
"url": "https://xtermjs.org/"
|
"url": "https://xtermjs.org/"
|
||||||
|
|||||||
@@ -341,10 +341,6 @@ describe('WebGL Renderer Integration Tests', async () => {
|
|||||||
await writeSync(page, data);
|
await writeSync(page, data);
|
||||||
for (let y = 0; y < 240 / 16; y++) {
|
for (let y = 0; y < 240 / 16; y++) {
|
||||||
for (let x = 0; x < 16; x++) {
|
for (let x = 0; x < 16; x++) {
|
||||||
const cssColor = COLORS_16_TO_255[y * 16 + x];
|
|
||||||
const r = parseInt(cssColor.substr(1, 2), 16);
|
|
||||||
const g = parseInt(cssColor.substr(3, 2), 16);
|
|
||||||
const b = parseInt(cssColor.substr(5, 2), 16);
|
|
||||||
await pollFor(page, () => getCellColor(x + 1, y + 1), [0, 0, 0, 255]);
|
await pollFor(page, () => getCellColor(x + 1, y + 1), [0, 0, 0, 255]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,7 +666,6 @@ describe('WebGL Renderer Integration Tests', async () => {
|
|||||||
await writeSync(page, data);
|
await writeSync(page, data);
|
||||||
for (let y = 0; y < 16; y++) {
|
for (let y = 0; y < 16; y++) {
|
||||||
for (let x = 0; x < 16; x++) {
|
for (let x = 0; x < 16; x++) {
|
||||||
const i = y * 16 + x;
|
|
||||||
await pollFor(page, () => getCellColor(x + 1, y + 1), [0, 0, 0, 255]);
|
await pollFor(page, () => getCellColor(x + 1, y + 1), [0, 0, 0, 255]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,11 +344,11 @@ function applyMacros(s) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceStatus(s) {
|
// function replaceStatus(s) {
|
||||||
if (s === 'supported') return '<span title="supported">✓</span>';
|
// if (s === 'supported') return '<span title="supported">✓</span>';
|
||||||
if (s === 'unsupported') return '<span title="unsupported">✗</span>';
|
// if (s === 'unsupported') return '<span title="unsupported">✗</span>';
|
||||||
return s;
|
// return s;
|
||||||
}
|
// }
|
||||||
|
|
||||||
function createAnchorSlug(s) {
|
function createAnchorSlug(s) {
|
||||||
return s.toLowerCase().split(' ').join('-');
|
return s.toLowerCase().split(' ').join('-');
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "xterm",
|
"name": "xterm",
|
||||||
"description": "Full xterm terminal, in your browser",
|
"description": "Full xterm terminal, in your browser",
|
||||||
"version": "4.4.0",
|
"version": "4.5.0",
|
||||||
"main": "lib/xterm.js",
|
"main": "lib/xterm.js",
|
||||||
"style": "css/xterm.css",
|
"style": "css/xterm.css",
|
||||||
"types": "typings/xterm.d.ts",
|
"types": "typings/xterm.d.ts",
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IEvent, EventEmitter } from 'common/EventEmitter';
|
import { IEvent, EventEmitter } from 'common/EventEmitter';
|
||||||
import { ICharSizeService, IMouseService } from 'browser/services/Services';
|
import { ICharSizeService, IMouseService, IRenderService } from 'browser/services/Services';
|
||||||
|
import { IRenderDimensions, IRenderer, CharacterJoinerHandler } from 'browser/renderer/Types';
|
||||||
|
import { IColorSet } from 'browser/Types';
|
||||||
|
|
||||||
export class MockCharSizeService implements ICharSizeService {
|
export class MockCharSizeService implements ICharSizeService {
|
||||||
serviceBrand: any;
|
serviceBrand: any;
|
||||||
@@ -24,3 +26,72 @@ export class MockMouseService implements IMouseService {
|
|||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class MockRenderService implements IRenderService {
|
||||||
|
serviceBrand: any;
|
||||||
|
onDimensionsChange: IEvent<IRenderDimensions> = new EventEmitter<IRenderDimensions>().event;
|
||||||
|
onRender: IEvent<{ start: number, end: number }, void> = new EventEmitter<{ start: number, end: number }>().event;
|
||||||
|
onRefreshRequest: IEvent<{ start: number, end: number}, void> = new EventEmitter<{ start: number, end: number }>().event;
|
||||||
|
dimensions: IRenderDimensions = {
|
||||||
|
scaledCharWidth: 0,
|
||||||
|
scaledCharHeight: 0,
|
||||||
|
scaledCellWidth: 0,
|
||||||
|
scaledCellHeight: 0,
|
||||||
|
scaledCharLeft: 0,
|
||||||
|
scaledCharTop: 0,
|
||||||
|
scaledCanvasWidth: 0,
|
||||||
|
scaledCanvasHeight: 0,
|
||||||
|
canvasWidth: 0,
|
||||||
|
canvasHeight: 0,
|
||||||
|
actualCellWidth: 0,
|
||||||
|
actualCellHeight: 0
|
||||||
|
};
|
||||||
|
refreshRows(start: number, end: number): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
resize(cols: number, rows: number): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
changeOptions(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
setRenderer(renderer: IRenderer): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
setColors(colors: IColorSet): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onDevicePixelRatioChange(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onResize(cols: number, rows: number): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onCharSizeChanged(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onBlur(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onFocus(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onSelectionChanged(start: [number, number], end: [number, number], columnSelectMode: boolean): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
onCursorMove(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
clear(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
registerCharacterJoiner(handler: CharacterJoinerHandler): number {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
deregisterCharacterJoiner(joinerId: number): boolean {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
dispose(): void {
|
||||||
|
throw new Error('Method not implemented.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -105,11 +105,6 @@ function moveToRequestedCol(startX: number, startY: number, targetX: number, tar
|
|||||||
).length, sequence(direction, applicationCursor));
|
).length, sequence(direction, applicationCursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveHorizontallyOnly(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): string {
|
|
||||||
const direction = horizontalDirection(startX, startY, targetX, targetY, bufferService, applicationCursor);
|
|
||||||
return repeat(Math.abs(startX - targetX), sequence(direction, applicationCursor));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions
|
* Utility functions
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,16 +10,18 @@ import { IBufferLine } from 'common/Types';
|
|||||||
import { MockBufferService, MockOptionsService, MockCoreService } from 'common/TestUtils.test';
|
import { MockBufferService, MockOptionsService, MockCoreService } from 'common/TestUtils.test';
|
||||||
import { BufferLine } from 'common/buffer/BufferLine';
|
import { BufferLine } from 'common/buffer/BufferLine';
|
||||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||||
import { MockCharSizeService, MockMouseService } from 'browser/TestUtils.test';
|
import { MockMouseService, MockRenderService } from 'browser/TestUtils.test';
|
||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
import { IBuffer } from 'common/buffer/Types';
|
import { IBuffer } from 'common/buffer/Types';
|
||||||
|
import { IRenderService } from 'browser/services/Services';
|
||||||
|
|
||||||
class TestSelectionService extends SelectionService {
|
class TestSelectionService extends SelectionService {
|
||||||
constructor(
|
constructor(
|
||||||
bufferService: IBufferService,
|
bufferService: IBufferService,
|
||||||
optionsService: IOptionsService
|
optionsService: IOptionsService,
|
||||||
|
renderService: IRenderService
|
||||||
) {
|
) {
|
||||||
super(() => {}, null!, null!, new MockCharSizeService(10, 10), bufferService, new MockCoreService(), new MockMouseService(), optionsService);
|
super(() => {}, null!, null!, bufferService, new MockCoreService(), new MockMouseService(), optionsService, renderService);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get model(): SelectionModel { return this._model; }
|
public get model(): SelectionModel { return this._model; }
|
||||||
@@ -46,7 +48,10 @@ describe('SelectionService', () => {
|
|||||||
optionsService = new MockOptionsService();
|
optionsService = new MockOptionsService();
|
||||||
bufferService = new MockBufferService(20, 20, optionsService);
|
bufferService = new MockBufferService(20, 20, optionsService);
|
||||||
buffer = bufferService.buffer;
|
buffer = bufferService.buffer;
|
||||||
selectionService = new TestSelectionService(bufferService, optionsService);
|
const renderService = new MockRenderService();
|
||||||
|
renderService.dimensions.canvasHeight = 10 * 20;
|
||||||
|
renderService.dimensions.canvasWidth = 10 * 20;
|
||||||
|
selectionService = new TestSelectionService(bufferService, optionsService, renderService);
|
||||||
});
|
});
|
||||||
|
|
||||||
function stringToRow(text: string): IBufferLine {
|
function stringToRow(text: string): IBufferLine {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import * as Browser from 'common/Platform';
|
|||||||
import { SelectionModel } from 'browser/selection/SelectionModel';
|
import { SelectionModel } from 'browser/selection/SelectionModel';
|
||||||
import { CellData } from 'common/buffer/CellData';
|
import { CellData } from 'common/buffer/CellData';
|
||||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||||
import { ICharSizeService, IMouseService, ISelectionService } from 'browser/services/Services';
|
import { ICharSizeService, IMouseService, ISelectionService, IRenderService } from 'browser/services/Services';
|
||||||
import { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';
|
import { IBufferService, IOptionsService, ICoreService } from 'common/services/Services';
|
||||||
import { getCoordsRelativeToElement } from 'browser/input/Mouse';
|
import { getCoordsRelativeToElement } from 'browser/input/Mouse';
|
||||||
import { moveToCellSequence } from 'browser/input/MoveToCell';
|
import { moveToCellSequence } from 'browser/input/MoveToCell';
|
||||||
@@ -116,11 +116,11 @@ export class SelectionService implements ISelectionService {
|
|||||||
private readonly _scrollLines: (amount: number, suppressEvent: boolean) => void,
|
private readonly _scrollLines: (amount: number, suppressEvent: boolean) => void,
|
||||||
private readonly _element: HTMLElement,
|
private readonly _element: HTMLElement,
|
||||||
private readonly _screenElement: HTMLElement,
|
private readonly _screenElement: HTMLElement,
|
||||||
@ICharSizeService private readonly _charSizeService: ICharSizeService,
|
|
||||||
@IBufferService private readonly _bufferService: IBufferService,
|
@IBufferService private readonly _bufferService: IBufferService,
|
||||||
@ICoreService private readonly _coreService: ICoreService,
|
@ICoreService private readonly _coreService: ICoreService,
|
||||||
@IMouseService private readonly _mouseService: IMouseService,
|
@IMouseService private readonly _mouseService: IMouseService,
|
||||||
@IOptionsService private readonly _optionsService: IOptionsService
|
@IOptionsService private readonly _optionsService: IOptionsService,
|
||||||
|
@IRenderService private readonly _renderService: IRenderService
|
||||||
) {
|
) {
|
||||||
// Init listeners
|
// Init listeners
|
||||||
this._mouseMoveListener = event => this._onMouseMove(<MouseEvent>event);
|
this._mouseMoveListener = event => this._onMouseMove(<MouseEvent>event);
|
||||||
@@ -374,7 +374,7 @@ export class SelectionService implements ISelectionService {
|
|||||||
*/
|
*/
|
||||||
private _getMouseEventScrollAmount(event: MouseEvent): number {
|
private _getMouseEventScrollAmount(event: MouseEvent): number {
|
||||||
let offset = getCoordsRelativeToElement(event, this._screenElement)[1];
|
let offset = getCoordsRelativeToElement(event, this._screenElement)[1];
|
||||||
const terminalHeight = this._bufferService.rows * Math.ceil(this._charSizeService.height * this._optionsService.options.lineHeight);
|
const terminalHeight = this._renderService.dimensions.canvasHeight;
|
||||||
if (offset >= 0 && offset <= terminalHeight) {
|
if (offset >= 0 && offset <= terminalHeight) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,12 @@ describe('Keyboard', () => {
|
|||||||
it('should return \\x1b[3;3~ for alt+delete', () => {
|
it('should return \\x1b[3;3~ for alt+delete', () => {
|
||||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 46 }).key, '\x1b[3;3~');
|
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 46 }).key, '\x1b[3;3~');
|
||||||
});
|
});
|
||||||
|
it('should return \\x1b\\r for alt+enter', () => {
|
||||||
|
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }).key, '\x1b\r');
|
||||||
|
});
|
||||||
|
it('should return \\x1b\\x1b for alt+esc', () => {
|
||||||
|
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 27 }).key, '\x1b\x1b');
|
||||||
|
});
|
||||||
it('should return \\x1b[5D for ctrl+left', () => {
|
it('should return \\x1b[5D for ctrl+left', () => {
|
||||||
assert.equal(testEvaluateKeyboardEvent({ ctrlKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D
|
assert.equal(testEvaluateKeyboardEvent({ ctrlKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D
|
||||||
});
|
});
|
||||||
@@ -141,6 +147,10 @@ describe('Keyboard', () => {
|
|||||||
it('should return \\x1ba for alt+a', () => {
|
it('should return \\x1ba for alt+a', () => {
|
||||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 65 }, { isMac: true, macOptionIsMeta: true }).key, '\x1ba');
|
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 65 }, { isMac: true, macOptionIsMeta: true }).key, '\x1ba');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return \\x1b\\x1b for alt+enter', () => {
|
||||||
|
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }, { isMac: true, macOptionIsMeta: true }).key, '\x1b\r');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return \\x1b[5A for alt+up', () => {
|
it('should return \\x1b[5A for alt+up', () => {
|
||||||
|
|||||||
@@ -103,12 +103,15 @@ export function evaluateKeyboardEvent(
|
|||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
// return/enter
|
// return/enter
|
||||||
result.key = C0.CR;
|
result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR;
|
||||||
result.cancel = true;
|
result.cancel = true;
|
||||||
break;
|
break;
|
||||||
case 27:
|
case 27:
|
||||||
// escape
|
// escape
|
||||||
result.key = C0.ESC;
|
result.key = C0.ESC;
|
||||||
|
if (ev.altKey) {
|
||||||
|
result.key = C0.ESC + C0.ESC;
|
||||||
|
}
|
||||||
result.cancel = true;
|
result.cancel = true;
|
||||||
break;
|
break;
|
||||||
case 37:
|
case 37:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { ICoreService, ILogService, IOptionsService, IBufferService } from 'common/services/Services';
|
import { ICoreService, ILogService, IOptionsService, IBufferService } from 'common/services/Services';
|
||||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||||
import { IDecPrivateModes, ICharset } from 'common/Types';
|
import { IDecPrivateModes } from 'common/Types';
|
||||||
import { clone } from 'common/Clone';
|
import { clone } from 'common/Clone';
|
||||||
|
|
||||||
const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
|
const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
|
||||||
|
|||||||
Reference in New Issue
Block a user