Merge branch 'v3' into zmodem

This commit is contained in:
Felipe Gasper
2017-10-25 07:30:04 -05:00
8 changed files with 201 additions and 178 deletions
+1
View File
@@ -135,6 +135,7 @@ export interface ITerminalOptions {
cursorStyle?: string;
debug?: boolean;
disableStdin?: boolean;
enableBold?: boolean;
fontSize?: number;
fontFamily?: string;
geometry?: [number, number];
+2
View File
@@ -77,6 +77,7 @@ const DEFAULT_OPTIONS: ITerminalOptions = {
cursorStyle: 'block',
bellSound: BellSound,
bellStyle: 'none',
enableBold: true,
fontFamily: 'courier-new, courier, monospace',
fontSize: 15,
lineHeight: 1.0,
@@ -411,6 +412,7 @@ export class Terminal extends EventEmitter implements ITerminal, IInputHandlingT
this.renderer.clear();
this.charMeasure.measure(this.options);
break;
case 'enableBold':
case 'letterSpacing':
case 'lineHeight':
// When the font changes the size of the cells may change which requires a renderer clear
+3
View File
@@ -170,6 +170,9 @@ export class MouseZoneManager implements IMouseZoneManager {
private _findZoneEventAt(e: MouseEvent): IMouseZone {
const coords = this._terminal.mouseHelper.getCoords(e, this._terminal.element, this._terminal.charMeasure, this._terminal.options.lineHeight, this._terminal.cols, this._terminal.rows);
if (!coords) {
return null;
}
for (let i = 0; i < this._zones.length; i++) {
const zone = this._zones[i];
if (zone.y === coords[1] && zone.x1 <= coords[0] && zone.x2 > coords[0]) {
+13 -3
View File
@@ -230,14 +230,14 @@ export abstract class BaseRenderLayer implements IRenderLayer {
colorIndex = fg + 2;
} else {
// If default color and bold
if (bold) {
if (bold && terminal.options.enableBold) {
colorIndex = 1;
}
}
const isAscii = code < 256;
// A color is basic if it is one of the standard normal or bold weight
// colors of the characters held in the char atlas. Note that this excludes
// the normal weight light color characters
// the normal weight _light_ color characters.
const isBasicColor = (colorIndex > 1 && fg < 16) && (fg < 8 || bold);
const isDefaultColor = fg >= 256;
const isDefaultBackground = bg >= 256;
@@ -245,10 +245,20 @@ export abstract class BaseRenderLayer implements IRenderLayer {
// ImageBitmap's draw about twice as fast as from a canvas
const charAtlasCellWidth = this._scaledCharWidth + CHAR_ATLAS_CELL_SPACING;
const charAtlasCellHeight = this._scaledCharHeight + CHAR_ATLAS_CELL_SPACING;
// Apply alpha to dim the character
if (dim) {
this._ctx.globalAlpha = DIM_OPACITY;
}
// Draw the non-bold version of the same color if bold is not enabled
if (bold && !terminal.options.enableBold) {
// Ignore default color as it's not touched above
if (colorIndex > 1) {
colorIndex -= 8;
}
}
this._ctx.drawImage(this._charAtlas,
code * charAtlasCellWidth,
colorIndex * charAtlasCellHeight,
@@ -280,7 +290,7 @@ export abstract class BaseRenderLayer implements IRenderLayer {
private _drawUncachedChar(terminal: ITerminal, char: string, width: number, fg: number, x: number, y: number, bold: boolean, dim: boolean): void {
this._ctx.save();
this._ctx.font = `${terminal.options.fontSize * window.devicePixelRatio}px ${terminal.options.fontFamily}`;
if (bold) {
if (bold && terminal.options.enableBold) {
this._ctx.font = `bold ${this._ctx.font}`;
}
this._ctx.textBaseline = 'top';
+13 -13
View File
@@ -35,7 +35,7 @@
* Default styles for xterm.js
*/
.terminal {
.xterm {
font-family: courier-new, courier, monospace;
font-feature-settings: "liga" 0;
position: relative;
@@ -44,12 +44,12 @@
-webkit-user-select: none;
}
.terminal.focus,
.terminal:focus {
.xterm.focus,
.xterm:focus {
outline: none;
}
.terminal .xterm-helpers {
.xterm .xterm-helpers {
position: absolute;
top: 0;
/**
@@ -59,7 +59,7 @@
z-index: 10;
}
.terminal .xterm-helper-textarea {
.xterm .xterm-helper-textarea {
/*
* HACK: to fix IE's blinking cursor
* Move textarea out of the screen to the far left, so that the cursor is not visible.
@@ -77,7 +77,7 @@
resize: none;
}
.terminal .composition-view {
.xterm .composition-view {
/* TODO: Composition position got messed up somewhere */
background: #000;
color: #FFF;
@@ -87,38 +87,38 @@
z-index: 1;
}
.terminal .composition-view.active {
.xterm .composition-view.active {
display: block;
}
.terminal .xterm-viewport {
.xterm .xterm-viewport {
/* On OS X this is required in order for the scroll bar to appear fully opaque */
background-color: #000;
overflow-y: scroll;
}
.terminal canvas {
.xterm canvas {
position: absolute;
left: 0;
top: 0;
}
.terminal .xterm-scroll-area {
.xterm .xterm-scroll-area {
visibility: hidden;
}
.terminal .xterm-char-measure-element {
.xterm .xterm-char-measure-element {
display: inline-block;
visibility: hidden;
position: absolute;
left: -9999em;
}
.terminal.enable-mouse-events {
.xterm.enable-mouse-events {
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor: default;
}
.terminal:not(.enable-mouse-events) {
.xterm:not(.enable-mouse-events) {
cursor: text;
}