Skip to content

Commit

Permalink
bump version of xterm
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Logan <Alex.Logan@arm.com>
  • Loading branch information
Alex Logan authored and Alex Logan committed Feb 20, 2020
1 parent 86704a9 commit 415f837
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
3 changes: 2 additions & 1 deletion packages/terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"@theia/filesystem": "^0.15.0",
"@theia/process": "^0.15.0",
"@theia/workspace": "^0.15.0",
"xterm": "3.13.0"
"xterm": "^4.4.0",
"xterm-addon-fit": "^0.3.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/terminal/src/browser/terminal-frontend-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
********************************************************************************/

import '../../src/browser/terminal.css';
import 'xterm/lib/xterm.css';
import 'xterm/css/xterm.css';

import { ContainerModule, Container } from 'inversify';
import { CommandContribution, MenuContribution } from '@theia/core/lib/common';
Expand Down
2 changes: 1 addition & 1 deletion packages/terminal/src/browser/terminal-linkmatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export abstract class AbstractCmdClickTerminalContribution implements TerminalCo
terminalWidget.showHoverMessage(event.clientX, event.clientY, this.getHoverMessage());
}
},
leaveCallback: (event: MouseEvent, uri: string) => {
leaveCallback: () => {
terminalWidget.hideHover();
},
validationCallback: async (uri: string, callBack: (isValid: boolean) => void) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/terminal/src/browser/terminal-theme-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import * as Xterm from 'xterm';
import { ITheme } from 'xterm';
import { injectable, inject } from 'inversify';
import { ColorRegistry, ColorDefaults } from '@theia/core/lib/browser/color-registry';
import { ThemeService } from '@theia/core/lib/browser/theming';
Expand Down Expand Up @@ -161,14 +161,14 @@ export class TerminalThemeService {

readonly onDidChange = ThemeService.get().onThemeChange;

get theme(): Xterm.ITheme {
get theme(): ITheme {
const foregroundColor = this.colorRegistry.getCurrentColor('terminal.foreground');
const backgroundColor = this.colorRegistry.getCurrentColor('terminal.background') || this.colorRegistry.getCurrentColor('panel.background');
const cursorColor = this.colorRegistry.getCurrentColor('terminalCursor.foreground') || foregroundColor;
const cursorAccentColor = this.colorRegistry.getCurrentColor('terminalCursor.background') || backgroundColor;
const selectionColor = this.colorRegistry.getCurrentColor('terminal.selectionBackground');

const theme: Xterm.ITheme = {
const theme: ITheme = {
background: backgroundColor,
foreground: foregroundColor,
cursor: cursorColor,
Expand Down
23 changes: 14 additions & 9 deletions packages/terminal/src/browser/terminal-widget-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import * as Xterm from 'xterm';
import { proposeGeometry } from 'xterm/lib/addons/fit/fit';
import { Terminal, RendererType } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import { inject, injectable, named, postConstruct } from 'inversify';
import { ContributionProvider, Disposable, Event, Emitter, ILogger, DisposableCollection } from '@theia/core';
import { Widget, Message, WebSocketConnectionProvider, StatefulWidget, isFirefox, MessageLoop, KeyCode } from '@theia/core/lib/browser';
Expand Down Expand Up @@ -48,7 +48,8 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
private readonly TERMINAL = 'Terminal';
protected readonly onTermDidClose = new Emitter<TerminalWidget>();
protected terminalId = -1;
protected term: Xterm.Terminal;
protected fitAddon: FitAddon;
protected term: Terminal;
protected restored = false;
protected closeOnDispose = true;
protected waitForConnection: Deferred<MessageConnection> | undefined;
Expand Down Expand Up @@ -88,8 +89,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
this.title.closable = true;
this.addClass('terminal-container');

this.term = new Xterm.Terminal({
experimentalCharAtlas: 'dynamic',
this.term = new Terminal({
cursorBlink: false,
fontFamily: this.preferences['terminal.integrated.fontFamily'],
fontSize: this.preferences['terminal.integrated.fontSize'],
Expand All @@ -102,6 +102,9 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
theme: this.themeService.theme
});

this.fitAddon = new FitAddon();
this.term.loadAddon(this.fitAddon);

this.hoverMessage = document.createElement('div');
this.hoverMessage.textContent = 'Cmd + click to follow link';
this.hoverMessage.style.position = 'fixed';
Expand Down Expand Up @@ -200,7 +203,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
*
* @param terminalRendererType desired terminal renderer type
*/
private getTerminalRendererType(terminalRendererType?: string | TerminalRendererType): Xterm.RendererType {
private getTerminalRendererType(terminalRendererType?: string | TerminalRendererType): RendererType {
if (terminalRendererType && isTerminalRendererType(terminalRendererType)) {
return terminalRendererType;
}
Expand All @@ -218,7 +221,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
this.hoverMessage.style.display = 'none';
}

getTerminal(): Xterm.Terminal {
getTerminal(): Terminal {
return this.term;
}

Expand Down Expand Up @@ -423,7 +426,9 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget

if (isFirefox) {
// The software scrollbars don't work with xterm.js, so we disable the scrollbar if we are on firefox.
(this.term.element.children.item(0) as HTMLElement).style.overflow = 'hidden';
if (this.term.element) {
(this.term.element.children.item(0) as HTMLElement).style.overflow = 'hidden';
}
}
}
protected write(data: string): void {
Expand Down Expand Up @@ -458,7 +463,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
}

protected resizeTerminal(): void {
const geo = proposeGeometry(this.term);
const geo = this.fitAddon.proposeDimensions();
const cols = geo.cols;
const rows = geo.rows - 1; // subtract one row for margin
this.term.resize(cols, rows);
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13362,10 +13362,15 @@ xtend@~2.1.1:
dependencies:
object-keys "~0.4.0"

xterm@3.13.0:
version "3.13.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.13.0.tgz#d0e06c3cf4c1f079aa83f646948457db3b04220b"
integrity sha512-FZVmvkkbkky3zldJ2NNOZ9h8jirtbGTlF4sIKMDrejR4wPsVZ3o4F++DQVkdeZqjAwtNOMoR17PMSOTZ+h070g==
xterm-addon-fit@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/xterm-addon-fit/-/xterm-addon-fit-0.3.0.tgz#341710741027de9d648a9f84415a01ddfdbbe715"
integrity sha512-kvkiqHVrnMXgyCH9Xn0BOBJ7XaWC/4BgpSWQy3SueqximgW630t/QOankgqkvk11iTOCwWdAY9DTyQBXUMN3lw==

xterm@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.4.0.tgz#5915d3c4c8800fadbcf555a0a603c672ab9df589"
integrity sha512-JGIpigWM3EBWvnS3rtBuefkiToIILSK1HYMXy4BCsUpO+O4UeeV+/U1AdAXgCB6qJrnPNb7yLgBsVCQUNMteig==

y18n@^3.2.1:
version "3.2.1"
Expand Down

0 comments on commit 415f837

Please sign in to comment.