Skip to content

Commit d673e02

Browse files
authored
Merge pull request #4089 from Tyriar/lgtm
Fix lgtm recommendations
2 parents 151a5d8 + 4a6e7be commit d673e02

File tree

17 files changed

+29
-40
lines changed

17 files changed

+29
-40
lines changed

addons/xterm-addon-canvas/src/SelectionRenderLayer.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
* @license MIT
44
*/
55

6-
import { IRenderDimensions, IRequestRedrawEvent } from 'browser/renderer/Types';
6+
import { IRenderDimensions } from 'browser/renderer/Types';
77
import { BaseRenderLayer } from './BaseRenderLayer';
88
import { IColorSet } from 'browser/Types';
99
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
1010
import { ICoreBrowserService } from 'browser/services/Services';
11-
import { IEventEmitter } from 'common/EventEmitter';
1211

1312
interface ISelectionState {
1413
start?: [number, number];

addons/xterm-addon-webgl/src/GlyphRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { WebglCharAtlas } from './atlas/WebglCharAtlas';
88
import { IWebGL2RenderingContext, IWebGLVertexArrayObject, IRenderModel, IRasterizedGlyph } from './Types';
99
import { fill } from 'common/TypedArrayUtils';
1010
import { NULL_CELL_CODE } from 'common/buffer/Constants';
11-
import { Terminal, IBufferLine } from 'xterm';
11+
import { Terminal } from 'xterm';
1212
import { IColorSet } from 'browser/Types';
1313
import { IRenderDimensions } from 'browser/renderer/Types';
1414
import { Disposable, toDisposable } from 'common/Lifecycle';

addons/xterm-addon-webgl/src/Types.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
* @license MIT
44
*/
55

6-
export interface IRasterizedGlyphSet {
7-
[bg: number]: { [fg: number]: { [ext: number]: IRasterizedGlyph } } | undefined;
8-
}
9-
106
/**
117
* Represents a rasterized glyph within a texture atlas. Some numbers are
128
* tracked in CSS pixels as well in order to reduce calculations during the

addons/xterm-addon-webgl/src/atlas/WebglCharAtlas.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { ICharAtlasConfig } from './Types';
77
import { DIM_OPACITY, TEXT_BASELINE } from 'browser/renderer/Constants';
8-
import { IRasterizedGlyph, IBoundingBox, IRasterizedGlyphSet } from '../Types';
8+
import { IRasterizedGlyph, IBoundingBox } from '../Types';
99
import { DEFAULT_COLOR, Attributes, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
1010
import { throwIfFalsy } from '../WebglUtils';
1111
import { IColor } from 'common/Types';
@@ -450,7 +450,6 @@ export class WebglCharAtlas implements IDisposable {
450450
// Underline style/stroke
451451
this._tmpCtx.beginPath();
452452
const xLeft = padding;
453-
const xRight = padding + this._config.scaledCellWidth * chWidth;
454453
const yTop = Math.ceil(padding + this._config.scaledCharHeight) - yOffset;
455454
const yMid = padding + this._config.scaledCharHeight + lineWidth - yOffset;
456455
const yBot = Math.ceil(padding + this._config.scaledCharHeight + lineWidth * 2) - yOffset;

addons/xterm-addon-webgl/src/renderLayer/CursorRenderLayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Terminal } from 'xterm';
77
import { BaseRenderLayer } from './BaseRenderLayer';
88
import { ICellData } from 'common/Types';
99
import { CellData } from 'common/buffer/CellData';
10-
import { IColorSet, ITerminal } from 'browser/Types';
10+
import { IColorSet } from 'browser/Types';
1111
import { IRenderDimensions, IRequestRedrawEvent } from 'browser/renderer/Types';
1212
import { IEventEmitter } from 'common/EventEmitter';
1313
import { ICoreBrowserService } from 'browser/services/Services';

bin/extract_vtfeatures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ function* parseMultiLineGen(filename, s) {
362362
if (!s.includes('@vt:')) {
363363
return;
364364
}
365-
const lines = s.split('\n').map(el => el.trim().replace(/\*/, '').replace(/\s/, ''));
365+
const lines = s.split('\n').map(el => el.trim().replace(/\*/, '').replace(/\s/, '')); // lgtm [js/incomplete-sanitization]
366366
let grabLine = false;
367367
let longDescription = [];
368368
let feature = undefined;

demo/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<link rel="shortcut icon" type="image/png" href="/logo.png">
1111
<link rel="stylesheet" href="/xterm.css" />
1212
<link rel="stylesheet" href="/style.css" />
13-
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js"></script>
14-
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
13+
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-promise/4.1.1/es6-promise.auto.min.js" integrity="sha384-kM3+BR0fKGmv8mDasMGLSHdqcbgWHUNWV1rAL+tkqnH578xS82vhlu9gR5BHhBai" crossorigin="anonymous"></script>
14+
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js" integrity="sha384-bR8my2pcqqtUkMMTomrgTyDVACSJz1M9D70XdkeK2BaYbCYxG3CfngYdSAOcPkUZ" crossorigin="anonymous"></script>
1515
</head>
1616
<body>
1717
<h1 style="color: #2D2E2C">xterm.js: A terminal for the <em style="color: #5DA5D5">web</em></h1>

src/browser/Terminal.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,20 @@ export class Terminal extends CoreTerminal implements ITerminal {
213213
acc = 'ansi';
214214
ident = '4;' + req.index;
215215
}
216-
if (acc) {
217-
switch (req.type) {
218-
case ColorRequestType.REPORT:
219-
const channels = color.toColorRGB(acc === 'ansi'
220-
? this._colorManager.colors.ansi[req.index]
221-
: this._colorManager.colors[acc]);
222-
this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(channels)}${C1_ESCAPED.ST}`);
223-
break;
224-
case ColorRequestType.SET:
225-
if (acc === 'ansi') this._colorManager.colors.ansi[req.index] = rgba.toColor(...req.color);
226-
else this._colorManager.colors[acc] = rgba.toColor(...req.color);
227-
break;
228-
case ColorRequestType.RESTORE:
229-
this._colorManager.restoreColor(req.index);
230-
break;
231-
}
216+
switch (req.type) {
217+
case ColorRequestType.REPORT:
218+
const channels = color.toColorRGB(acc === 'ansi'
219+
? this._colorManager.colors.ansi[req.index]
220+
: this._colorManager.colors[acc]);
221+
this.coreService.triggerDataEvent(`${C0.ESC}]${ident};${toRgbString(channels)}${C1_ESCAPED.ST}`);
222+
break;
223+
case ColorRequestType.SET:
224+
if (acc === 'ansi') this._colorManager.colors.ansi[req.index] = rgba.toColor(...req.color);
225+
else this._colorManager.colors[acc] = rgba.toColor(...req.color);
226+
break;
227+
case ColorRequestType.RESTORE:
228+
this._colorManager.restoreColor(req.index);
229+
break;
232230
}
233231
}
234232
this._renderService?.setColors(this._colorManager.colors);

src/browser/TestUtils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration }
77
import { IEvent, EventEmitter } from 'common/EventEmitter';
88
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService } from 'browser/services/Services';
99
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/Types';
10-
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, IColorManager, ICompositionHelper, CharacterJoinerHandler, IRenderDebouncer, IBufferRange } from 'browser/Types';
10+
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, IColorManager, ICompositionHelper, CharacterJoinerHandler, IBufferRange } from 'browser/Types';
1111
import { IBuffer, IBufferStringIterator, IBufferSet } from 'common/buffer/Types';
1212
import { IBufferLine, ICellData, IAttributeData, ICircularList, XtermListener, ICharset, ITerminalOptions } from 'common/Types';
1313
import { Buffer } from 'common/buffer/Buffer';

src/browser/decorations/OverviewRulerRenderer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations
77
import { addDisposableDomListener } from 'browser/Lifecycle';
88
import { IRenderService } from 'browser/services/Services';
99
import { Disposable } from 'common/Lifecycle';
10-
import { IBufferService, IDecorationService, IInternalDecoration, IOptionsService } from 'common/services/Services';
10+
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
1111

1212
// Helper objects to avoid excessive calculation and garbage collection during rendering. These are
1313
// static values for each render and can be accessed using the decoration position as the key.

0 commit comments

Comments
 (0)