change WindowOptions type
This commit is contained in:
@@ -7,6 +7,7 @@ import { IOptionsService, ITerminalOptions, IPartialTerminalOptions } from 'comm
|
||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||
import { isMac } from 'common/Platform';
|
||||
import { clone } from 'common/Clone';
|
||||
import { setWindowOptions, getWindowOptions } from 'common/WindowOptions';
|
||||
|
||||
// Source: https://freesound.org/people/altemark/sounds/45759/
|
||||
// This sound is released under the Creative Commons Attribution 3.0 Unported
|
||||
@@ -14,33 +15,6 @@ import { clone } from 'common/Clone';
|
||||
// made, apart from the conversion to base64.
|
||||
export const DEFAULT_BELL_SOUND = 'data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjMyLjEwNAAAAAAAAAAAAAAA//tQxAADB8AhSmxhIIEVCSiJrDCQBTcu3UrAIwUdkRgQbFAZC1CQEwTJ9mjRvBA4UOLD8nKVOWfh+UlK3z/177OXrfOdKl7pyn3Xf//WreyTRUoAWgBgkOAGbZHBgG1OF6zM82DWbZaUmMBptgQhGjsyYqc9ae9XFz280948NMBWInljyzsNRFLPWdnZGWrddDsjK1unuSrVN9jJsK8KuQtQCtMBjCEtImISdNKJOopIpBFpNSMbIHCSRpRR5iakjTiyzLhchUUBwCgyKiweBv/7UsQbg8isVNoMPMjAAAA0gAAABEVFGmgqK////9bP/6XCykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq';
|
||||
|
||||
// setting names controlled by allowedWindowOps
|
||||
// not supported: GetChecksum, GetSelection, SetChecksum, SetSelection, SetXprop
|
||||
export const WINDOW_OPTIONS: {[key: string]: number} = {
|
||||
'RestoreWin': 1,
|
||||
'MinimizeWin': 2,
|
||||
'SetWinPosition': 3,
|
||||
'SetWinSizePixels': 4,
|
||||
'RaiseWin': 5,
|
||||
'LowerWin': 6,
|
||||
'RefreshWin': 7,
|
||||
'SetWinSizeChars': 8,
|
||||
'MaximizeWin': 9,
|
||||
'FullscreenWin': 10,
|
||||
'GetWinState': 11,
|
||||
'GetWinPosition': 13,
|
||||
'GetWinSizePixels': 14,
|
||||
'GetScreenSizePixels': 15, // note: name not in xterm
|
||||
'GetCellSizePixels': 16, // note: name not in xterm
|
||||
'GetWinSizeChars': 18,
|
||||
'GetScreenSizeChars': 19,
|
||||
'GetIconTitle': 20,
|
||||
'GetWinTitle': 21,
|
||||
'PushTitle': 22,
|
||||
'PopTitle': 23,
|
||||
'SetWinLines': 24 // any param >= 24, also handles DECCOLM
|
||||
};
|
||||
|
||||
|
||||
// TODO: Freeze?
|
||||
export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
|
||||
@@ -79,7 +53,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
|
||||
cancelEvents: false,
|
||||
useFlowControl: false,
|
||||
wordSeparator: ' ()[]{}\',:;"',
|
||||
allowedWindowOps: []
|
||||
windowOptions: 0
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -157,20 +131,8 @@ export class OptionsService implements IOptionsService {
|
||||
throw new Error(`${key} cannot be less than or equal to 0, value: ${value}`);
|
||||
}
|
||||
break;
|
||||
case 'allowedWindowOps':
|
||||
const values = (value as string).split(',');
|
||||
const cleaned: number[] = [];
|
||||
for (let i = 0; i < values.length; ++i) {
|
||||
const option = parseInt(values[i].trim()) || WINDOW_OPTIONS[values[i].trim()];
|
||||
if (!option || option < 0 || option > 24) {
|
||||
throw new Error(`unknown window option "${values[i]}"`);
|
||||
}
|
||||
if (!~cleaned.indexOf(option)) {
|
||||
cleaned.push(option);
|
||||
}
|
||||
}
|
||||
value = cleaned;
|
||||
break;
|
||||
case 'windowOptions':
|
||||
value = setWindowOptions(value, this.options.windowOptions);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -179,8 +141,8 @@ export class OptionsService implements IOptionsService {
|
||||
if (!(key in DEFAULT_OPTIONS)) {
|
||||
throw new Error(`No option with key "${key}"`);
|
||||
}
|
||||
if (key === 'allowedWindowOps') {
|
||||
return this.options[key].join();
|
||||
if (key === 'windowOptions') {
|
||||
return getWindowOptions(this.options.windowOptions);
|
||||
}
|
||||
return this.options[key];
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { IEvent } from 'common/EventEmitter';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType } from 'common/Types';
|
||||
import { createDecorator } from 'common/services/ServiceRegistry';
|
||||
import { WindowOptions } from 'common/WindowOptions';
|
||||
|
||||
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
||||
export interface IBufferService {
|
||||
@@ -207,7 +208,7 @@ export interface IPartialTerminalOptions {
|
||||
theme?: ITheme;
|
||||
windowsMode?: boolean;
|
||||
wordSeparator?: string;
|
||||
allowedWindowOps?: number[];
|
||||
windowOptions?: WindowOptions;
|
||||
}
|
||||
|
||||
export interface ITerminalOptions {
|
||||
@@ -247,7 +248,7 @@ export interface ITerminalOptions {
|
||||
screenKeys: boolean;
|
||||
termName: string;
|
||||
useFlowControl: boolean;
|
||||
allowedWindowOps: number[];
|
||||
windowOptions: WindowOptions;
|
||||
}
|
||||
|
||||
export interface ITheme {
|
||||
@@ -273,3 +274,4 @@ export interface ITheme {
|
||||
brightCyan?: string;
|
||||
brightWhite?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user