Disallow single-line brace-style blocks
Set allowSingleLine to false and expand multi-line braces across the codebase via eslint --fix. Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
co-authored by
Daniel Imms
parent
1c42ae9af4
commit
1040b799ce
@@ -21,7 +21,9 @@ const enum Constants {
|
||||
*/
|
||||
export class ImageRenderer extends Disposable implements IDisposable {
|
||||
/** @deprecated Kept for backward compat — points to top layer canvas. */
|
||||
public get canvas(): HTMLCanvasElement | undefined { return this._layers.get('top')?.canvas; }
|
||||
public get canvas(): HTMLCanvasElement | undefined {
|
||||
return this._layers.get('top')?.canvas;
|
||||
}
|
||||
private _layers = new Map<ImageLayer, CanvasRenderingContext2D>();
|
||||
private _placeholder: HTMLCanvasElement | undefined;
|
||||
private _placeholderBitmap: ImageBitmap | undefined;
|
||||
|
||||
@@ -31,7 +31,9 @@ class ExtendedAttrsImage implements IExtendedAttrsImage {
|
||||
}
|
||||
return this._ext;
|
||||
}
|
||||
public set ext(value: number) { this._ext = value; }
|
||||
public set ext(value: number) {
|
||||
this._ext = value;
|
||||
}
|
||||
|
||||
public get underlineStyle(): UnderlineStyle {
|
||||
// Always return the URL style if it has one
|
||||
|
||||
@@ -322,7 +322,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('chunked transfer responds OK on final chunk when i= on first only', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
const half = Math.floor(KITTY_BLACK_1X1_BASE64.length / 2);
|
||||
@@ -542,7 +544,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
let response = '';
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=31,a=q;\x1b\\');
|
||||
@@ -556,7 +560,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
let response = '';
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=42,a=q,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -581,7 +587,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
let response = '';
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=60,a=q,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -595,7 +603,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
let response = '';
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=70,a=q,f=24;AAAA\x1b\\');
|
||||
@@ -608,7 +618,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('suppresses OK response when q=1', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=80,a=q,q=1,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -620,7 +632,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('suppresses OK response when q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=81,a=q,q=2,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -632,7 +646,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('suppresses error response when q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=90,a=q,q=2,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -645,7 +661,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
let response = '';
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
// Per spec: "Specifying both i and I keys in any command is an error"
|
||||
@@ -660,7 +678,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
let response = '';
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
// Delete command with both i and I (no payload case)
|
||||
@@ -676,7 +696,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=t sends EINVAL on decode error when id is specified', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=110,a=t,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -689,7 +711,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=t sends no response on decode error without id', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Ga=t,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -701,7 +725,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T sends EINVAL on decode error when id is specified', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=120,a=T,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -714,7 +740,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T sends no response on decode error without id', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Ga=T,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -726,7 +754,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T sends EINVAL when raw pixel render fails (missing dimensions)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=130,a=T,f=24;${RAW_RGB_1X1_BLACK}\x1b\\`);
|
||||
@@ -739,7 +769,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T sends OK on successful render with id', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=140,a=T,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -752,7 +784,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=t sends OK on successful transmit with id', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=150,a=t,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -765,7 +799,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=t EINVAL suppressed by q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=160,a=t,q=2,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -777,7 +813,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T EINVAL suppressed by q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write('\x1b_Gi=170,a=T,q=2,f=100;!!!invalid!!!\x1b\\');
|
||||
@@ -789,7 +827,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=t OK suppressed by q=1', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=180,a=t,q=1,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -801,7 +841,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T OK suppressed by q=1', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=190,a=T,q=1,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -813,7 +855,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=t OK suppressed by q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=181,a=t,q=2,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -825,7 +869,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('a=T OK suppressed by q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=191,a=T,q=2,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -839,7 +885,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query rejects t=f (file transmission)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=200,a=q,t=f,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -852,7 +900,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query rejects t=s (shared memory)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=201,a=q,t=s,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -865,7 +915,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query rejects t=t (temp file)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=202,a=q,t=t,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -878,7 +930,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query accepts t=d (direct transmission)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=203,a=q,t=d,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -891,7 +945,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query without t key defaults to direct (OK)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=204,a=q,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -904,7 +960,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit rejects t=f with id (EINVAL response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=300,a=t,t=f,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -917,7 +975,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit rejects t=s with id (EINVAL response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=301,a=t,t=s,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -930,7 +990,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit rejects t=t with id (EINVAL response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=302,a=t,t=t,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -943,7 +1005,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit rejects t=f without id (no response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=t,t=f,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -956,7 +1020,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit+display rejects t=f with id (EINVAL response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=310,a=T,t=f,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -969,7 +1035,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit+display rejects t=s with id (EINVAL response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=311,a=T,t=s,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -982,7 +1050,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit+display rejects t=t with id (EINVAL response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=312,a=T,t=t,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -995,7 +1065,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('transmit+display rejects t=f without id (no response)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=T,t=f,f=100;${KITTY_BLACK_1X1_BASE64}\x1b\\`);
|
||||
@@ -1026,7 +1098,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=211\x1b\\`);
|
||||
@@ -1039,7 +1113,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('responds ENOENT for non-existent image id', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=9999\x1b\\`);
|
||||
@@ -1052,7 +1128,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('without id sends no response', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p\x1b\\`);
|
||||
@@ -1172,7 +1250,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=220,q=1\x1b\\`);
|
||||
@@ -1188,7 +1268,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=221,q=2\x1b\\`);
|
||||
@@ -1201,7 +1283,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('ENOENT error suppressed by q=2', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyGotResponse = false;
|
||||
(window as any).term.onData(() => { (window as any).kittyGotResponse = true; });
|
||||
(window as any).term.onData(() => {
|
||||
(window as any).kittyGotResponse = true;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=9998,q=2\x1b\\`);
|
||||
@@ -1213,7 +1297,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('ENOENT still reported when q=1 (only suppresses OK)', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=9997,q=1\x1b\\`);
|
||||
@@ -1268,7 +1354,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Ga=p,i=224,p=42\x1b\\`);
|
||||
@@ -1803,7 +1891,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('responds with OK for valid 200x100 PNG query', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
|
||||
await ctx.proxy.write(`\x1b_Gi=600,a=q,f=100;${KITTY_MULTICOLOR_200X100_BASE64}\x1b\\`);
|
||||
@@ -1952,7 +2042,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query returns EINVAL without dimensions', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
await ctx.proxy.write(`\x1b_Gi=200,a=q,f=24;${RAW_RGB_1X1_BLACK}\x1b\\`);
|
||||
await timeout(100);
|
||||
@@ -1963,7 +2055,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query returns EINVAL for insufficient pixel data', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
await ctx.proxy.write(`\x1b_Gi=201,a=q,f=24,s=2,v=2;${RAW_RGB_1X1_BLACK}\x1b\\`);
|
||||
await timeout(100);
|
||||
@@ -1974,7 +2068,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query returns OK for valid RGB data with correct dimensions', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
await ctx.proxy.write(`\x1b_Gi=202,a=q,f=24,s=1,v=1;${RAW_RGB_1X1_RED}\x1b\\`);
|
||||
await timeout(100);
|
||||
@@ -2086,7 +2182,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query returns EINVAL without dimensions', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
await ctx.proxy.write(`\x1b_Gi=300,a=q,f=32;${RAW_RGBA_1X1_RED}\x1b\\`);
|
||||
await timeout(100);
|
||||
@@ -2097,7 +2195,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query returns EINVAL for insufficient pixel data', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
await ctx.proxy.write(`\x1b_Gi=301,a=q,f=32,s=2,v=2;${RAW_RGBA_1X1_RED}\x1b\\`);
|
||||
await timeout(100);
|
||||
@@ -2108,7 +2208,9 @@ test.describe('Kitty Graphics Protocol', () => {
|
||||
test('query returns OK for valid RGBA data with correct dimensions', async () => {
|
||||
await ctx.page.evaluate(() => {
|
||||
(window as any).kittyResponse = '';
|
||||
(window as any).term.onData((data: string) => { (window as any).kittyResponse = data; });
|
||||
(window as any).term.onData((data: string) => {
|
||||
(window as any).kittyResponse = data;
|
||||
});
|
||||
});
|
||||
await ctx.proxy.write(`\x1b_Gi=302,a=q,f=32,s=1,v=1;${RAW_RGBA_1X1_RED}\x1b\\`);
|
||||
await timeout(100);
|
||||
|
||||
@@ -46,7 +46,9 @@ describe('LigaturesAddon', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
onRefresh = Object.assign((..._args: any[]) => { onRefresh.called = true; onRefresh.callCount++; }, { called: false, callCount: 0 });
|
||||
onRefresh = Object.assign((..._args: any[]) => {
|
||||
onRefresh.called = true; onRefresh.callCount++;
|
||||
}, { called: false, callCount: 0 });
|
||||
term = new MockTerminal(onRefresh);
|
||||
ligatureSupport.enableLigatures(term as any);
|
||||
});
|
||||
@@ -127,7 +129,9 @@ class MockTerminal {
|
||||
public deregisterCharacterJoiner(id: number): void {
|
||||
this.joiner = undefined;
|
||||
}
|
||||
public get options(): { [name: string]: string | number } { return this._options; }
|
||||
public get options(): { [name: string]: string | number } {
|
||||
return this._options;
|
||||
}
|
||||
public set options(options: { [name: string]: string | number }) {
|
||||
for (const key in this._options) {
|
||||
this._options[key] = options[key];
|
||||
|
||||
@@ -64,7 +64,9 @@ export class DecorationManager extends Disposable {
|
||||
public createActiveDecoration(result: ISearchResult, options: ISearchDecorationOptions): IMultiHighlight | undefined {
|
||||
const decorations = this._createResultDecorations(result, options, true);
|
||||
if (decorations) {
|
||||
return { decorations, match: result, dispose() { dispose(decorations); } };
|
||||
return { decorations, match: result, dispose() {
|
||||
dispose(decorations);
|
||||
} };
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -85,7 +87,9 @@ export class DecorationManager extends Disposable {
|
||||
*/
|
||||
private _storeDecoration(decoration: IDecoration, match: ISearchResult): void {
|
||||
this._highlightedLines.add(decoration.marker.line);
|
||||
this._highlightDecorations.push({ decoration, match, dispose() { decoration.dispose(); } });
|
||||
this._highlightDecorations.push({ decoration, match, dispose() {
|
||||
decoration.dispose();
|
||||
} });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,9 @@ export class SearchResultTracker extends Disposable {
|
||||
private _selectedDecoration: ISelectedDecoration | undefined;
|
||||
|
||||
private readonly _onDidChangeResults = this._register(new Emitter<ISearchResultChangeEvent>());
|
||||
public get onDidChangeResults(): IEvent<ISearchResultChangeEvent> { return this._onDidChangeResults.event; }
|
||||
public get onDidChangeResults(): IEvent<ISearchResultChangeEvent> {
|
||||
return this._onDidChangeResults.event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current search results.
|
||||
|
||||
@@ -29,12 +29,20 @@ class TestSelectionService {
|
||||
this._model = new SelectionModel(bufferService);
|
||||
}
|
||||
|
||||
public get model(): SelectionModel { return this._model; }
|
||||
public get model(): SelectionModel {
|
||||
return this._model;
|
||||
}
|
||||
|
||||
public get hasSelection(): boolean { return this._hasSelection; }
|
||||
public get hasSelection(): boolean {
|
||||
return this._hasSelection;
|
||||
}
|
||||
|
||||
public get selectionStart(): [number, number] | undefined { return this._model.finalSelectionStart; }
|
||||
public get selectionEnd(): [number, number] | undefined { return this._model.finalSelectionEnd; }
|
||||
public get selectionStart(): [number, number] | undefined {
|
||||
return this._model.finalSelectionStart;
|
||||
}
|
||||
public get selectionEnd(): [number, number] | undefined {
|
||||
return this._model.finalSelectionEnd;
|
||||
}
|
||||
|
||||
public setSelection(col: number, row: number, length: number): void {
|
||||
this._model.selectionStart = [col, row];
|
||||
|
||||
@@ -70,7 +70,9 @@ abstract class BaseSerializeHandler {
|
||||
protected _rowEnd(row: number, isLastRow: boolean): void { }
|
||||
protected _beforeSerialize(rows: number, startRow: number, endRow: number): void { }
|
||||
protected _afterSerialize(): void { }
|
||||
protected _serializeString(excludeFinalCursorPosition?: boolean): string { return ''; }
|
||||
protected _serializeString(excludeFinalCursorPosition?: boolean): string {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function equalFg(cell1: IBufferCell | IAttributeData, cell2: IBufferCell): boolean {
|
||||
@@ -291,19 +293,39 @@ class StringSerializeHandler extends BaseSerializeHandler {
|
||||
} else {
|
||||
if (fgChanged) {
|
||||
const color = cell.getFgColor();
|
||||
if (cell.isFgRGB()) { sgrSeq.push(38, 2, (color >>> 16) & 0xFF, (color >>> 8) & 0xFF, color & 0xFF); } else if (cell.isFgPalette()) {
|
||||
if (color >= 16) { sgrSeq.push(38, 5, color); } else { sgrSeq.push(color & 8 ? 90 + (color & 7) : 30 + (color & 7)); }
|
||||
} else { sgrSeq.push(39); }
|
||||
if (cell.isFgRGB()) {
|
||||
sgrSeq.push(38, 2, (color >>> 16) & 0xFF, (color >>> 8) & 0xFF, color & 0xFF);
|
||||
} else if (cell.isFgPalette()) {
|
||||
if (color >= 16) {
|
||||
sgrSeq.push(38, 5, color);
|
||||
} else {
|
||||
sgrSeq.push(color & 8 ? 90 + (color & 7) : 30 + (color & 7));
|
||||
}
|
||||
} else {
|
||||
sgrSeq.push(39);
|
||||
}
|
||||
}
|
||||
if (bgChanged) {
|
||||
const color = cell.getBgColor();
|
||||
if (cell.isBgRGB()) { sgrSeq.push(48, 2, (color >>> 16) & 0xFF, (color >>> 8) & 0xFF, color & 0xFF); } else if (cell.isBgPalette()) {
|
||||
if (color >= 16) { sgrSeq.push(48, 5, color); } else { sgrSeq.push(color & 8 ? 100 + (color & 7) : 40 + (color & 7)); }
|
||||
} else { sgrSeq.push(49); }
|
||||
if (cell.isBgRGB()) {
|
||||
sgrSeq.push(48, 2, (color >>> 16) & 0xFF, (color >>> 8) & 0xFF, color & 0xFF);
|
||||
} else if (cell.isBgPalette()) {
|
||||
if (color >= 16) {
|
||||
sgrSeq.push(48, 5, color);
|
||||
} else {
|
||||
sgrSeq.push(color & 8 ? 100 + (color & 7) : 40 + (color & 7));
|
||||
}
|
||||
} else {
|
||||
sgrSeq.push(49);
|
||||
}
|
||||
}
|
||||
if (flagsChanged) {
|
||||
if (cell.isInverse() !== oldCell.isInverse()) { sgrSeq.push(cell.isInverse() ? 7 : 27); }
|
||||
if (cell.isBold() !== oldCell.isBold()) { sgrSeq.push(cell.isBold() ? 1 : 22); }
|
||||
if (cell.isInverse() !== oldCell.isInverse()) {
|
||||
sgrSeq.push(cell.isInverse() ? 7 : 27);
|
||||
}
|
||||
if (cell.isBold() !== oldCell.isBold()) {
|
||||
sgrSeq.push(cell.isBold() ? 1 : 22);
|
||||
}
|
||||
if (!equalUnderline(cell, oldCell)) {
|
||||
const style = cell.getUnderlineStyle();
|
||||
if (style === UnderlineStyle.NONE) {
|
||||
@@ -326,12 +348,24 @@ class StringSerializeHandler extends BaseSerializeHandler {
|
||||
} else if (cell.isUnderline() !== oldCell.isUnderline()) {
|
||||
sgrSeq.push(cell.isUnderline() ? 4 : 24);
|
||||
}
|
||||
if (cell.isOverline() !== oldCell.isOverline()) { sgrSeq.push(cell.isOverline() ? 53 : 55); }
|
||||
if (cell.isBlink() !== oldCell.isBlink()) { sgrSeq.push(cell.isBlink() ? 5 : 25); }
|
||||
if (cell.isInvisible() !== oldCell.isInvisible()) { sgrSeq.push(cell.isInvisible() ? 8 : 28); }
|
||||
if (cell.isItalic() !== oldCell.isItalic()) { sgrSeq.push(cell.isItalic() ? 3 : 23); }
|
||||
if (cell.isDim() !== oldCell.isDim()) { sgrSeq.push(cell.isDim() ? 2 : 22); }
|
||||
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) { sgrSeq.push(cell.isStrikethrough() ? 9 : 29); }
|
||||
if (cell.isOverline() !== oldCell.isOverline()) {
|
||||
sgrSeq.push(cell.isOverline() ? 53 : 55);
|
||||
}
|
||||
if (cell.isBlink() !== oldCell.isBlink()) {
|
||||
sgrSeq.push(cell.isBlink() ? 5 : 25);
|
||||
}
|
||||
if (cell.isInvisible() !== oldCell.isInvisible()) {
|
||||
sgrSeq.push(cell.isInvisible() ? 8 : 28);
|
||||
}
|
||||
if (cell.isItalic() !== oldCell.isItalic()) {
|
||||
sgrSeq.push(cell.isItalic() ? 3 : 23);
|
||||
}
|
||||
if (cell.isDim() !== oldCell.isDim()) {
|
||||
sgrSeq.push(cell.isDim() ? 2 : 22);
|
||||
}
|
||||
if (cell.isStrikethrough() !== oldCell.isStrikethrough()) {
|
||||
sgrSeq.push(cell.isStrikethrough() ? 9 : 29);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -745,8 +779,12 @@ export class HTMLSerializeHandler extends BaseSerializeHandler {
|
||||
content.push('background-color: ' + bgHexColor + ';');
|
||||
}
|
||||
|
||||
if (cell.isInverse()) { content.push('color: #000000; background-color: #BFBFBF;'); }
|
||||
if (cell.isBold()) { content.push('font-weight: bold;'); }
|
||||
if (cell.isInverse()) {
|
||||
content.push('color: #000000; background-color: #BFBFBF;');
|
||||
}
|
||||
if (cell.isBold()) {
|
||||
content.push('font-weight: bold;');
|
||||
}
|
||||
|
||||
// Handle text-decoration (underline, overline, strikethrough, blink)
|
||||
const decorations: string[] = [];
|
||||
@@ -774,9 +812,15 @@ export class HTMLSerializeHandler extends BaseSerializeHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (cell.isInvisible()) { content.push('visibility: hidden;'); }
|
||||
if (cell.isItalic()) { content.push('font-style: italic;'); }
|
||||
if (cell.isDim()) { content.push('opacity: 0.5;'); }
|
||||
if (cell.isInvisible()) {
|
||||
content.push('visibility: hidden;');
|
||||
}
|
||||
if (cell.isItalic()) {
|
||||
content.push('font-style: italic;');
|
||||
}
|
||||
if (cell.isDim()) {
|
||||
content.push('opacity: 0.5;');
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,9 @@ export class CursorBlinkStateManager {
|
||||
}
|
||||
}
|
||||
|
||||
public get isPaused(): boolean { return !(this._blinkStartTimeout || this._blinkInterval); }
|
||||
public get isPaused(): boolean {
|
||||
return !(this._blinkStartTimeout || this._blinkInterval);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
if (this._blinkInterval) {
|
||||
|
||||
@@ -62,7 +62,9 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
|
||||
// The texture that the atlas is drawn to
|
||||
private _pages: AtlasPage[] = [];
|
||||
public get pages(): { canvas: HTMLCanvasElement, version: number }[] { return this._pages; }
|
||||
public get pages(): { canvas: HTMLCanvasElement, version: number }[] {
|
||||
return this._pages;
|
||||
}
|
||||
|
||||
// The set of atlas pages that can be written to
|
||||
private _activePages: AtlasPage[] = [];
|
||||
@@ -1039,10 +1041,14 @@ class AtlasPage {
|
||||
public readonly ctx: CanvasRenderingContext2D;
|
||||
|
||||
private _usedPixels: number = 0;
|
||||
public get percentageUsed(): number { return this._usedPixels / (this.canvas.width * this.canvas.height); }
|
||||
public get percentageUsed(): number {
|
||||
return this._usedPixels / (this.canvas.width * this.canvas.height);
|
||||
}
|
||||
|
||||
private readonly _glyphs: IRasterizedGlyph[] = [];
|
||||
public get glyphs(): ReadonlyArray<IRasterizedGlyph> { return this._glyphs; }
|
||||
public get glyphs(): ReadonlyArray<IRasterizedGlyph> {
|
||||
return this._glyphs;
|
||||
}
|
||||
public addGlyph(glyph: IRasterizedGlyph): void {
|
||||
this._glyphs.push(glyph);
|
||||
this._usedPixels += glyph.size.x * glyph.size.y;
|
||||
|
||||
Reference in New Issue
Block a user