windowOptions on ctor options

This commit is contained in:
Jörg Breitbart
2019-11-14 12:20:59 +01:00
parent 26052a2963
commit 45d1139ab0
7 changed files with 32 additions and 31 deletions
+1
View File
@@ -75,6 +75,7 @@ export class MockLogService implements ILogService {
export class MockOptionsService implements IOptionsService {
serviceBrand: any;
options: ITerminalOptions = clone(DEFAULT_OPTIONS);
windowOptions = 0;
onOptionChange: IEvent<string> = new EventEmitter<string>().event;
constructor(testOptions?: IPartialTerminalOptions) {
if (testOptions) {
-1
View File
@@ -256,7 +256,6 @@ export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
* WindowOption settings.
*/
export interface IWindowOptions {
[key: string]: boolean | undefined;
restoreWin?: boolean;
minimizeWin?: boolean;
setWinPosition?: boolean;
+8 -4
View File
@@ -7,7 +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';
import { setWindowOptions, getWindowOptions, WindowOptions } from 'common/WindowOptions';
// Source: https://freesound.org/people/altemark/sounds/45759/
// This sound is released under the Creative Commons Attribution 3.0 Unported
@@ -53,7 +53,7 @@ export const DEFAULT_OPTIONS: ITerminalOptions = Object.freeze({
cancelEvents: false,
useFlowControl: false,
wordSeparator: ' ()[]{}\',:;"',
windowOptions: 0
windowOptions: {}
});
/**
@@ -65,6 +65,7 @@ export class OptionsService implements IOptionsService {
serviceBrand: any;
public options: ITerminalOptions;
public windowOptions: WindowOptions = 0;
private _onOptionChange = new EventEmitter<string>();
public get onOptionChange(): IEvent<string> { return this._onOptionChange.event; }
@@ -77,6 +78,9 @@ export class OptionsService implements IOptionsService {
this.options[k] = newValue;
}
});
if (options.windowOptions) {
this.windowOptions = setWindowOptions(options.windowOptions as any, 0);
}
}
public setOption(key: string, value: any): void {
@@ -132,7 +136,7 @@ export class OptionsService implements IOptionsService {
}
break;
case 'windowOptions':
value = setWindowOptions(value, this.options.windowOptions);
this.windowOptions = setWindowOptions(value, this.windowOptions);
}
return value;
}
@@ -142,7 +146,7 @@ export class OptionsService implements IOptionsService {
throw new Error(`No option with key "${key}"`);
}
if (key === 'windowOptions') {
return getWindowOptions(this.options.windowOptions);
return getWindowOptions(this.windowOptions);
}
return this.options[key];
}
+4 -3
View File
@@ -5,7 +5,7 @@
import { IEvent } from 'common/EventEmitter';
import { IBuffer, IBufferSet } from 'common/buffer/Types';
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType } from 'common/Types';
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, IWindowOptions } from 'common/Types';
import { createDecorator } from 'common/services/ServiceRegistry';
import { WindowOptions } from 'common/WindowOptions';
@@ -167,6 +167,7 @@ export interface IOptionsService {
serviceBrand: any;
readonly options: ITerminalOptions;
readonly windowOptions: WindowOptions;
readonly onOptionChange: IEvent<string>;
@@ -208,7 +209,7 @@ export interface IPartialTerminalOptions {
theme?: ITheme;
windowsMode?: boolean;
wordSeparator?: string;
windowOptions?: WindowOptions;
windowOptions?: IWindowOptions;
}
export interface ITerminalOptions {
@@ -248,7 +249,7 @@ export interface ITerminalOptions {
screenKeys: boolean;
termName: string;
useFlowControl: boolean;
windowOptions: WindowOptions;
windowOptions: IWindowOptions;
}
export interface ITheme {