Skip to content

Commit 9fca3d8

Browse files
authored
Merge branch 'master' into 5626
2 parents 6f87ae7 + 8eed7b4 commit 9fca3d8

99 files changed

Lines changed: 2308 additions & 1334 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addons/addon-attach/src/AttachAddon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface IAttachOptions {
1212
bidirectional?: boolean;
1313
}
1414

15-
export class AttachAddon implements ITerminalAddon , IAttachApi {
15+
export class AttachAddon implements ITerminalAddon, IAttachApi {
1616
private _socket: WebSocket;
1717
private _bidirectional: boolean;
1818
private _disposables: IDisposable[] = [];

addons/addon-fit/src/FitAddon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function _getComputedStyle(el: HTMLElement): CSSStyleDeclaration {
3333
return getWindow(el).getComputedStyle(el, null);
3434
}
3535

36-
export class FitAddon implements ITerminalAddon , IFitApi {
36+
export class FitAddon implements ITerminalAddon, IFitApi {
3737
private _terminal: Terminal | undefined;
3838

3939
public activate(terminal: Terminal): void {

addons/addon-image/src/ImageAddon.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const enum GaStatus {
4848
}
4949

5050

51-
export class ImageAddon implements ITerminalAddon , IImageApi {
51+
export class ImageAddon implements ITerminalAddon, IImageApi {
5252
private _opts: IImageAddonOptions;
5353
private _defaultOpts: IImageAddonOptions;
5454
private _storage: ImageStorage | undefined;
@@ -90,7 +90,7 @@ export class ImageAddon implements ITerminalAddon , IImageApi {
9090
// windowOptions.getCellSizePixels = true;
9191
// windowOptions.getWinSizeChars = true;
9292
// terminal.setOption('windowOptions', windowOptions);
93-
const windowOps = terminal.options.windowOptions || {};
93+
const windowOps = terminal.options.windowOptions ?? {};
9494
windowOps.getWinSizePixels = true;
9595
windowOps.getCellSizePixels = true;
9696
windowOps.getWinSizeChars = true;

addons/addon-image/src/ImageRenderer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ImageRenderer extends Disposable implements IDisposable {
3838
* Only the DOM output canvas should be on the terminal's document,
3939
* which gets explicitly checked in `insertLayerToDom`.
4040
*/
41-
const canvas = (localDocument || document).createElement('canvas');
41+
const canvas = (localDocument ?? document).createElement('canvas');
4242
canvas.width = width | 0;
4343
canvas.height = height | 0;
4444
return canvas;
@@ -242,7 +242,7 @@ export class ImageRenderer extends Disposable implements IDisposable {
242242
}
243243
if (!this._placeholder) return;
244244
this._ctx.drawImage(
245-
this._placeholderBitmap || this._placeholder!,
245+
this._placeholderBitmap ?? this._placeholder!,
246246
col * width,
247247
(row * height) % 2 ? 0 : 1, // needs %2 offset correction
248248
width * count,

addons/addon-image/src/ImageStorage.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ export class ImageStorage implements IDisposable {
381381
if (!line) return;
382382
for (let col = 0; col < cols; ++col) {
383383
if (line.getBg(col) & BgFlags.HAS_EXTENDED) {
384-
let e: IExtendedAttrsImage = line._extendedAttrs[col] || EMPTY_ATTRS;
384+
let e: IExtendedAttrsImage = line._extendedAttrs[col] ?? EMPTY_ATTRS;
385385
const imageId = e.imageId;
386386
if (imageId === undefined || imageId === -1) {
387387
continue;
@@ -400,7 +400,7 @@ export class ImageStorage implements IDisposable {
400400
while (
401401
++col < cols
402402
&& (line.getBg(col) & BgFlags.HAS_EXTENDED)
403-
&& (e = line._extendedAttrs[col] || EMPTY_ATTRS)
403+
&& (e = line._extendedAttrs[col] ?? EMPTY_ATTRS)
404404
&& (e.imageId === imageId)
405405
&& (e.tileId === startTile + count)
406406
) {
@@ -442,7 +442,7 @@ export class ImageStorage implements IDisposable {
442442
for (let row = 0; row < rows; ++row) {
443443
const line = buffer.lines.get(row) as IBufferLineExt;
444444
if (line.getBg(oldCol) & BgFlags.HAS_EXTENDED) {
445-
const e: IExtendedAttrsImage = line._extendedAttrs[oldCol] || EMPTY_ATTRS;
445+
const e: IExtendedAttrsImage = line._extendedAttrs[oldCol] ?? EMPTY_ATTRS;
446446
const imageId = e.imageId;
447447
if (imageId === undefined || imageId === -1) {
448448
continue;
@@ -487,7 +487,7 @@ export class ImageStorage implements IDisposable {
487487
const buffer = this._terminal._core.buffer;
488488
const line = buffer.lines.get(y) as IBufferLineExt;
489489
if (line && line.getBg(x) & BgFlags.HAS_EXTENDED) {
490-
const e: IExtendedAttrsImage = line._extendedAttrs[x] || EMPTY_ATTRS;
490+
const e: IExtendedAttrsImage = line._extendedAttrs[x] ?? EMPTY_ATTRS;
491491
if (e.imageId && e.imageId !== -1) {
492492
const orig = this._images.get(e.imageId)?.orig;
493493
if (window.ImageBitmap && orig instanceof ImageBitmap) {
@@ -507,7 +507,7 @@ export class ImageStorage implements IDisposable {
507507
const buffer = this._terminal._core.buffer;
508508
const line = buffer.lines.get(y) as IBufferLineExt;
509509
if (line && line.getBg(x) & BgFlags.HAS_EXTENDED) {
510-
const e: IExtendedAttrsImage = line._extendedAttrs[x] || EMPTY_ATTRS;
510+
const e: IExtendedAttrsImage = line._extendedAttrs[x] ?? EMPTY_ATTRS;
511511
if (e.imageId && e.imageId !== -1 && e.tileId !== -1) {
512512
const spec = this._images.get(e.imageId);
513513
if (spec) {

addons/addon-ligatures/src/LigaturesAddon.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface ITerminalAddon {
1313
dispose(): void;
1414
}
1515

16-
export class LigaturesAddon implements ITerminalAddon , ILigaturesApi {
16+
export class LigaturesAddon implements ITerminalAddon, ILigaturesApi {
1717
private readonly _fallbackLigatures: string[];
1818
private readonly _fontFeatureSettings?: string;
1919

@@ -22,7 +22,7 @@ export class LigaturesAddon implements ITerminalAddon , ILigaturesApi {
2222

2323
constructor(options?: Partial<ILigatureOptions>) {
2424
// Source: calt set from https://github.com/be5invis/Iosevka?tab=readme-ov-file#ligations
25-
this._fallbackLigatures = (options?.fallbackLigatures || [
25+
this._fallbackLigatures = (options?.fallbackLigatures ?? [
2626
'<--', '<---', '<<-', '<-', '->', '->>', '-->', '--->',
2727
'<==', '<===', '<<=', '<=', '=>', '=>>', '==>', '===>', '>=', '>>=',
2828
'<->', '<-->', '<--->', '<---->', '<=>', '<==>', '<===>', '<====>', '::', ':::',

addons/addon-ligatures/src/font.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ export default async function load(fontFamily: string, cacheSize: number): Promi
8080
console.error(err.name, err.message);
8181
}
8282
}
83-
if (!fontsPromise) {
84-
fontsPromise = Promise.resolve({});
85-
}
83+
fontsPromise ??= Promise.resolve({});
8684
}
8785

8886
const fonts = await fontsPromise;

addons/addon-ligatures/src/fontLigatures/processors/helper.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ export function processLookaheadPosition(
5252
}
5353
processedEntries.add(currentEntry.entry);
5454

55-
if (!currentEntry.entry.forward) {
56-
currentEntry.entry.forward = {
57-
individual: {},
58-
range: []
59-
};
60-
}
55+
currentEntry.entry.forward ??= {
56+
individual: {},
57+
range: []
58+
};
6159

6260
// All glyphs at this position share ONE entry - lookahead just needs to match,
6361
// all paths lead to the same result
@@ -97,12 +95,10 @@ export function processBacktrackPosition(
9795
}
9896
processedEntries.add(currentEntry.entry);
9997

100-
if (!currentEntry.entry.reverse) {
101-
currentEntry.entry.reverse = {
102-
individual: {},
103-
range: []
104-
};
105-
}
98+
currentEntry.entry.reverse ??= {
99+
individual: {},
100+
range: []
101+
};
106102

107103
// All glyphs at this position share ONE entry - backtrack just needs to match,
108104
// all paths lead to the same result

addons/addon-ligatures/src/fontLigatures/processors/substitution.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ export function getIndividualSubstitutionGlyph(table: SubstitutionTable, glyphId
5454
return (glyphId + table.deltaGlyphId) % (2 ** 16);
5555
// https://docs.microsoft.com/en-us/typography/opentype/spec/gsub#12-single-substitution-format-2
5656
case 2:
57-
// eslint-disable-next-line eqeqeq
58-
return table.substitute[coverageIndex] != null
59-
? table.substitute[coverageIndex]
60-
: null;
57+
return table.substitute[coverageIndex] ?? null;
6158
}
6259
}

addons/addon-search/src/SearchEngine.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ export class SearchEngine {
198198
}
199199
}
200200

201-
if (!result) {
202-
result = this._findInLine(term, searchPosition, searchOptions, isReverseSearch);
203-
}
201+
result ??= this._findInLine(term, searchPosition, searchOptions, isReverseSearch);
204202

205203
// Search from startRow - 1 to top
206204
if (!result) {

0 commit comments

Comments
 (0)