Add IntRange type for ColorIndex

Fixes #4614
This commit is contained in:
Daniel Imms
2023-07-28 13:51:46 -07:00
parent 17b8247c3d
commit 79c1fff853
5 changed files with 59 additions and 46 deletions
+4 -4
View File
@@ -35,7 +35,7 @@ import * as Strings from 'browser/LocalizableStrings';
import { AccessibilityManager } from './AccessibilityManager';
import { ITheme, IMarker, IDisposable, ILinkProvider, IDecorationOptions, IDecoration } from 'xterm';
import { DomRenderer } from 'browser/renderer/dom/DomRenderer';
import { KeyboardResultType, CoreMouseEventType, CoreMouseButton, CoreMouseAction, ITerminalOptions, ScrollSource, IColorEvent, ColorIndex, ColorRequestType } from 'common/Types';
import { KeyboardResultType, CoreMouseEventType, CoreMouseButton, CoreMouseAction, ITerminalOptions, ScrollSource, IColorEvent, ColorIndex, ColorRequestType, ColorIndexValue } from 'common/Types';
import { evaluateKeyboardEvent } from 'common/input/Keyboard';
import { EventEmitter, IEvent, forwardEvent } from 'common/EventEmitter';
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
@@ -203,15 +203,15 @@ export class Terminal extends CoreTerminal implements ITerminal {
let acc: 'foreground' | 'background' | 'cursor' | 'ansi';
let ident = '';
switch (req.index) {
case ColorIndex.FOREGROUND: // OSC 10 | 110
case ColorIndexValue.FOREGROUND: // OSC 10 | 110
acc = 'foreground';
ident = '10';
break;
case ColorIndex.BACKGROUND: // OSC 11 | 111
case ColorIndexValue.BACKGROUND: // OSC 11 | 111
acc = 'background';
ident = '11';
break;
case ColorIndex.CURSOR: // OSC 12 | 112
case ColorIndexValue.CURSOR: // OSC 12 | 112
acc = 'cursor';
ident = '12';
break;
+4 -4
View File
@@ -10,7 +10,7 @@ import { channels, color, css, NULL_COLOR } from 'common/Color';
import { EventEmitter } from 'common/EventEmitter';
import { Disposable } from 'common/Lifecycle';
import { IOptionsService, ITheme } from 'common/services/Services';
import { ColorIndex, IColor } from 'common/Types';
import { ColorIndex, ColorIndexValue, IColor } from 'common/Types';
interface IRestoreColorSet {
foreground: IColor;
@@ -190,13 +190,13 @@ export class ThemeService extends Disposable implements IThemeService {
return;
}
switch (slot) {
case ColorIndex.FOREGROUND:
case ColorIndexValue.FOREGROUND:
this._colors.foreground = this._restoreColors.foreground;
break;
case ColorIndex.BACKGROUND:
case ColorIndexValue.BACKGROUND:
this._colors.background = this._restoreColors.background;
break;
case ColorIndex.CURSOR:
case ColorIndexValue.CURSOR:
this._colors.cursor = this._restoreColors.cursor;
break;
default: