Merge branch 'master' into master

This commit is contained in:
Johan Knutzen
2021-10-18 11:02:13 -07:00
committed by GitHub
6 changed files with 52 additions and 28 deletions
+1
View File
@@ -184,6 +184,7 @@ Xterm.js is used in several world-class applications to provide great terminal e
- [**HashiCorp Nomad**](https://www.nomadproject.io/): A container orchestrator with the ability to connect to remote tasks via a web interface using websockets and xterm.js. - [**HashiCorp Nomad**](https://www.nomadproject.io/): A container orchestrator with the ability to connect to remote tasks via a web interface using websockets and xterm.js.
- [**TermPair**](https://github.com/cs01/termpair): View and control terminals from your browser with end-to-end encryption - [**TermPair**](https://github.com/cs01/termpair): View and control terminals from your browser with end-to-end encryption
- [**gdbgui**](https://github.com/cs01/gdbgui): Browser-based frontend to gdb (gnu debugger) - [**gdbgui**](https://github.com/cs01/gdbgui): Browser-based frontend to gdb (gnu debugger)
- [**goormIDE**](https://ide.goorm.io/): Run almost every programming languages with real-time collaboration, live pair programming, and built-in messenger.
- [And much more...](https://github.com/xtermjs/xterm.js/network/dependents) - [And much more...](https://github.com/xtermjs/xterm.js/network/dependents)
Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it on our list. Note: Please add any new contributions to the end of the list only. Do you use xterm.js in your application as well? Please [open a Pull Request](https://github.com/sourcelair/xterm.js/pulls) to include it here. We would love to have it on our list. Note: Please add any new contributions to the end of the list only.
@@ -8,6 +8,7 @@ import { WebglRenderer } from './WebglRenderer';
import { ICharacterJoinerService, IRenderService } from 'browser/services/Services'; import { ICharacterJoinerService, IRenderService } from 'browser/services/Services';
import { IColorSet } from 'browser/Types'; import { IColorSet } from 'browser/Types';
import { EventEmitter } from 'common/EventEmitter'; import { EventEmitter } from 'common/EventEmitter';
import { isSafari } from 'common/Platform';
export class WebglAddon implements ITerminalAddon { export class WebglAddon implements ITerminalAddon {
private _terminal?: Terminal; private _terminal?: Terminal;
@@ -23,6 +24,9 @@ export class WebglAddon implements ITerminalAddon {
if (!terminal.element) { if (!terminal.element) {
throw new Error('Cannot activate WebglAddon before Terminal.open'); throw new Error('Cannot activate WebglAddon before Terminal.open');
} }
if (isSafari) {
throw new Error('Webgl is not currently supported on Safari');
}
this._terminal = terminal; this._terminal = terminal;
const renderService: IRenderService = (terminal as any)._core._renderService; const renderService: IRenderService = (terminal as any)._core._renderService;
const characterJoinerService: ICharacterJoinerService = (terminal as any)._core._characterJoinerService; const characterJoinerService: ICharacterJoinerService = (terminal as any)._core._characterJoinerService;
+9
View File
@@ -164,6 +164,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
// Setup InputHandler listeners // Setup InputHandler listeners
this.register(this._inputHandler.onRequestBell(() => this.bell())); this.register(this._inputHandler.onRequestBell(() => this.bell()));
this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end))); this.register(this._inputHandler.onRequestRefreshRows((start, end) => this.refresh(start, end)));
this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus()));
this.register(this._inputHandler.onRequestReset(() => this.reset())); this.register(this._inputHandler.onRequestReset(() => this.reset()));
this.register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type))); this.register(this._inputHandler.onRequestWindowsOptionsReport(type => this._reportWindowsOptions(type)));
this.register(this._inputHandler.onAnsiColorChange((event) => this._changeAnsiColor(event))); this.register(this._inputHandler.onAnsiColorChange((event) => this._changeAnsiColor(event)));
@@ -1296,6 +1297,14 @@ export class Terminal extends CoreTerminal implements ITerminal {
this._renderService?.clearTextureAtlas(); this._renderService?.clearTextureAtlas();
} }
private _reportFocus(): void {
if (this.element?.classList.contains('focus')) {
this.coreService.triggerDataEvent(C0.ESC + '[I');
} else {
this.coreService.triggerDataEvent(C0.ESC + '[O');
}
}
private _reportWindowsOptions(type: WindowsOptionsReportType): void { private _reportWindowsOptions(type: WindowsOptionsReportType): void {
if (!this._renderService) { if (!this._renderService) {
return; return;
@@ -10,7 +10,7 @@ import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags,
import { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine'; import { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { IBufferLine } from 'common/Types'; import { IBufferLine } from 'common/Types';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { MockOptionsService } from 'common/TestUtils.test'; import { MockCoreService, MockOptionsService } from 'common/TestUtils.test';
import { css } from 'browser/Color'; import { css } from 'browser/Color';
import { MockCharacterJoinerService } from 'browser/TestUtils.test'; import { MockCharacterJoinerService } from 'browser/TestUtils.test';
@@ -21,30 +21,36 @@ describe('DomRendererRowFactory', () => {
beforeEach(() => { beforeEach(() => {
dom = new jsdom.JSDOM(''); dom = new jsdom.JSDOM('');
rowFactory = new DomRendererRowFactory(dom.window.document, { rowFactory = new DomRendererRowFactory(
background: css.toColor('#010101'), dom.window.document,
foreground: css.toColor('#020202'), {
ansi: [ background: css.toColor('#010101'),
// dark: foreground: css.toColor('#020202'),
css.toColor('#2e3436'), ansi: [
css.toColor('#cc0000'), // dark:
css.toColor('#4e9a06'), css.toColor('#2e3436'),
css.toColor('#c4a000'), css.toColor('#cc0000'),
css.toColor('#3465a4'), css.toColor('#4e9a06'),
css.toColor('#75507b'), css.toColor('#c4a000'),
css.toColor('#06989a'), css.toColor('#3465a4'),
css.toColor('#d3d7cf'), css.toColor('#75507b'),
// bright: css.toColor('#06989a'),
css.toColor('#555753'), css.toColor('#d3d7cf'),
css.toColor('#ef2929'), // bright:
css.toColor('#8ae234'), css.toColor('#555753'),
css.toColor('#fce94f'), css.toColor('#ef2929'),
css.toColor('#729fcf'), css.toColor('#8ae234'),
css.toColor('#ad7fa8'), css.toColor('#fce94f'),
css.toColor('#34e2e2'), css.toColor('#729fcf'),
css.toColor('#eeeeec') css.toColor('#ad7fa8'),
] css.toColor('#34e2e2'),
} as any, new MockCharacterJoinerService(), new MockOptionsService({ drawBoldTextInBrightColors: true })); css.toColor('#eeeeec')
]
} as any,
new MockCharacterJoinerService(),
new MockOptionsService({ drawBoldTextInBrightColors: true }),
new MockCoreService()
);
lineData = createEmptyLineData(2); lineData = createEmptyLineData(2);
}); });
@@ -7,7 +7,7 @@ import { IBufferLine } from 'common/Types';
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants'; import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/atlas/Constants';
import { NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants'; import { NULL_CELL_CODE, WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { IOptionsService } from 'common/services/Services'; import { ICoreService, IOptionsService } from 'common/services/Services';
import { color, rgba } from 'browser/Color'; import { color, rgba } from 'browser/Color';
import { IColorSet, IColor } from 'browser/Types'; import { IColorSet, IColor } from 'browser/Types';
import { ICharacterJoinerService } from 'browser/services/Services'; import { ICharacterJoinerService } from 'browser/services/Services';
@@ -31,7 +31,8 @@ export class DomRendererRowFactory {
private readonly _document: Document, private readonly _document: Document,
private _colors: IColorSet, private _colors: IColorSet,
@ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService, @ICharacterJoinerService private readonly _characterJoinerService: ICharacterJoinerService,
@IOptionsService private readonly _optionsService: IOptionsService @IOptionsService private readonly _optionsService: IOptionsService,
@ICoreService private readonly _coreService: ICoreService
) { ) {
} }
@@ -110,7 +111,7 @@ export class DomRendererRowFactory {
} }
} }
if (isCursorRow && x === cursorX) { if (!this._coreService.isCursorHidden && isCursorRow && x === cursorX) {
charElement.classList.add(CURSOR_CLASS); charElement.classList.add(CURSOR_CLASS);
if (cursorBlink) { if (cursorBlink) {
+3
View File
@@ -243,6 +243,8 @@ export class InputHandler extends Disposable implements IInputHandler {
public get onRequestRefreshRows(): IEvent<number, number> { return this._onRequestRefreshRows.event; } public get onRequestRefreshRows(): IEvent<number, number> { return this._onRequestRefreshRows.event; }
private _onRequestReset = new EventEmitter<void>(); private _onRequestReset = new EventEmitter<void>();
public get onRequestReset(): IEvent<void> { return this._onRequestReset.event; } public get onRequestReset(): IEvent<void> { return this._onRequestReset.event; }
private _onRequestSendFocus = new EventEmitter<void>();
public get onRequestSendFocus(): IEvent<void> { return this._onRequestSendFocus.event; }
private _onRequestSyncScrollBar = new EventEmitter<void>(); private _onRequestSyncScrollBar = new EventEmitter<void>();
public get onRequestSyncScrollBar(): IEvent<void> { return this._onRequestSyncScrollBar.event; } public get onRequestSyncScrollBar(): IEvent<void> { return this._onRequestSyncScrollBar.event; }
private _onRequestWindowsOptionsReport = new EventEmitter<WindowsOptionsReportType>(); private _onRequestWindowsOptionsReport = new EventEmitter<WindowsOptionsReportType>();
@@ -1956,6 +1958,7 @@ export class InputHandler extends Disposable implements IInputHandler {
// focusin: ^[[I // focusin: ^[[I
// focusout: ^[[O // focusout: ^[[O
this._coreService.decPrivateModes.sendFocus = true; this._coreService.decPrivateModes.sendFocus = true;
this._onRequestSendFocus.fire();
break; break;
case 1005: // utf8 ext mode mouse - removed in #2507 case 1005: // utf8 ext mode mouse - removed in #2507
this._logService.debug('DECSET 1005 not supported (see #2507)'); this._logService.debug('DECSET 1005 not supported (see #2507)');