diff --git a/src/renderer/webgl/atlas/CharAtlasUtils.ts b/src/renderer/webgl/atlas/CharAtlasUtils.ts index 2bda420f..9bbd614a 100644 --- a/src/renderer/webgl/atlas/CharAtlasUtils.ts +++ b/src/renderer/webgl/atlas/CharAtlasUtils.ts @@ -17,7 +17,7 @@ export function generateConfig(scaledCharWidth: number, scaledCharHeight: number selection: null, // For the static char atlas, we only use the first 16 colors, but we need all 256 for the // dynamic character atlas. - ansi: colors.ansi.slice(0, 16) + ansi: colors.ansi.slice() }; return { devicePixelRatio: window.devicePixelRatio, diff --git a/src/renderer/webgl/atlas/WebglCharAtlas.ts b/src/renderer/webgl/atlas/WebglCharAtlas.ts index a9cd8e7d..85496aa1 100644 --- a/src/renderer/webgl/atlas/WebglCharAtlas.ts +++ b/src/renderer/webgl/atlas/WebglCharAtlas.ts @@ -11,7 +11,6 @@ import { is256Color } from './CharAtlasUtils'; import { clearColor } from './CharAtlasGenerator'; import { DEFAULT_ATTR } from '../../../core/buffer/BufferLine'; import { DEFAULT_COLOR } from '../../../common/Types'; -import { DEFAULT_ANSI_COLORS } from '../../../ui/ColorManager'; import { IColor } from 'xterm'; // In practice we're probably never going to exhaust a texture this large. For debugging purposes, @@ -158,10 +157,10 @@ export default class WebglCharAtlas extends BaseCharAtlas { } private _getColorFromAnsiIndex(idx: number): IColor { - if (idx < this._config.colors.ansi.length) { - return this._config.colors.ansi[idx]; + if (idx >= this._config.colors.ansi.length) { + throw new Error('No color found for idx ' + idx); } - return DEFAULT_ANSI_COLORS[idx]; + return this._config.colors.ansi[idx]; } private _getBackgroundColor(bg: number): IColor { diff --git a/src/ui/ColorManager.ts b/src/ui/ColorManager.ts index 923b2823..276b6e14 100644 --- a/src/ui/ColorManager.ts +++ b/src/ui/ColorManager.ts @@ -16,7 +16,7 @@ const DEFAULT_SELECTION = { // An IIFE to generate DEFAULT_ANSI_COLORS. Do not mutate DEFAULT_ANSI_COLORS, instead make a copy // and mutate that. -export const DEFAULT_ANSI_COLORS = (() => { +export const DEFAULT_ANSI_COLORS: IColor[] = (() => { const colors = [ // dark: fromHex('#2e3436'),