mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
@@ -173,6 +173,7 @@ function createTerminal(): void {
|
||||
|
||||
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0;
|
||||
term = new Terminal({
|
||||
allowTransparency: true,
|
||||
windowsMode: isWindows,
|
||||
fontFamily: 'Fira Code, courier-new, courier, monospace'
|
||||
} as ITerminalOptions);
|
||||
|
||||
Vendored
+2
@@ -35,6 +35,8 @@ export interface ITerminalOptions extends IPublicTerminalOptions {
|
||||
termName?: string;
|
||||
}
|
||||
|
||||
export type CursorStyle = 'block' | 'underline' | 'bar';
|
||||
|
||||
export type XtermListener = (...args: any[]) => void;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { IOptionsService, ITerminalOptions, FontWeight } from 'common/services/Services';
|
||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||
import { isMac } from 'common/Platform';
|
||||
import { CursorStyle } from 'common/Types';
|
||||
|
||||
// Source: https://freesound.org/people/altemark/sounds/45759/
|
||||
// This sound is released under the Creative Commons Attribution 3.0 Unported
|
||||
@@ -123,6 +124,14 @@ export class OptionsService implements IOptionsService {
|
||||
|
||||
private _sanitizeAndValidateOption(key: string, value: any): any {
|
||||
switch (key) {
|
||||
case 'cursorStyle':
|
||||
if (!value) {
|
||||
value = DEFAULT_OPTIONS[key];
|
||||
}
|
||||
if (!isCursorStyle(value)) {
|
||||
throw new Error(`"${value}" is not a valid value for ${key}`);
|
||||
}
|
||||
break;
|
||||
case 'bellStyle':
|
||||
case 'cursorStyle':
|
||||
case 'rendererType':
|
||||
@@ -176,3 +185,7 @@ export class OptionsService implements IOptionsService {
|
||||
return this.options[key];
|
||||
}
|
||||
}
|
||||
|
||||
function isCursorStyle(value: unknown): value is CursorStyle {
|
||||
return value === 'block' || value === 'underline' || value === 'bar';
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColorRGB, IColor } from 'common/Types';
|
||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColorRGB, IColor, CursorStyle } from 'common/Types';
|
||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||
import { IDecorationOptions, IDecoration } from 'xterm';
|
||||
|
||||
@@ -217,7 +217,7 @@ export interface ITerminalOptions {
|
||||
cols: number;
|
||||
convertEol: boolean;
|
||||
cursorBlink: boolean;
|
||||
cursorStyle: 'block' | 'underline' | 'bar';
|
||||
cursorStyle: CursorStyle,
|
||||
cursorWidth: number;
|
||||
customGlyphs: boolean;
|
||||
disableStdin: boolean;
|
||||
|
||||
Reference in New Issue
Block a user