Merge pull request #3341 from coderaiser/feature/lint-with-putout
chore: lint using putout
This commit is contained in:
@@ -20,7 +20,7 @@ export class AttachAddon implements ITerminalAddon {
|
|||||||
this._socket = socket;
|
this._socket = socket;
|
||||||
// always set binary type to arraybuffer, we do not handle blobs
|
// always set binary type to arraybuffer, we do not handle blobs
|
||||||
this._socket.binaryType = 'arraybuffer';
|
this._socket.binaryType = 'arraybuffer';
|
||||||
this._bidirectional = (options && options.bidirectional === false) ? false : true;
|
this._bidirectional = !(options && options.bidirectional === false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public activate(terminal: Terminal): void {
|
public activate(terminal: Terminal): void {
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ export class SearchAddon implements ITerminalAddon {
|
|||||||
// If it is not in the viewport then we scroll else it just gets selected
|
// If it is not in the viewport then we scroll else it just gets selected
|
||||||
if (result.row >= (terminal.buffer.active.viewportY + terminal.rows) || result.row < terminal.buffer.active.viewportY) {
|
if (result.row >= (terminal.buffer.active.viewportY + terminal.rows) || result.row < terminal.buffer.active.viewportY) {
|
||||||
let scroll = result.row - terminal.buffer.active.viewportY;
|
let scroll = result.row - terminal.buffer.active.viewportY;
|
||||||
scroll = scroll - Math.floor(terminal.rows / 2);
|
scroll -= Math.floor(terminal.rows / 2);
|
||||||
terminal.scrollLines(scroll);
|
terminal.scrollLines(scroll);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ export class GlyphRenderer {
|
|||||||
// Get attributes from fg (excluding inverse) and resolve inverse by pullibng rgb colors
|
// Get attributes from fg (excluding inverse) and resolve inverse by pullibng rgb colors
|
||||||
// from bg. This is needed since the inverse fg color should be based on the original bg
|
// from bg. This is needed since the inverse fg color should be based on the original bg
|
||||||
// color, not on the selection color
|
// color, not on the selection color
|
||||||
fg = (fg & ~(Attributes.CM_MASK | Attributes.RGB_MASK | FgFlags.INVERSE));
|
fg &= ~(Attributes.CM_MASK | Attributes.RGB_MASK | FgFlags.INVERSE);
|
||||||
switch (workCell.getBgColorMode()) {
|
switch (workCell.getBgColorMode()) {
|
||||||
case Attributes.CM_P16:
|
case Attributes.CM_P16:
|
||||||
case Attributes.CM_P256:
|
case Attributes.CM_P256:
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ export class WebglRenderer extends Disposable implements IRenderer {
|
|||||||
|
|
||||||
// Flag combined chars with a bit mask so they're easily identifiable
|
// Flag combined chars with a bit mask so they're easily identifiable
|
||||||
if (chars.length > 1) {
|
if (chars.length > 1) {
|
||||||
code = code | COMBINED_CHAR_BIT_MASK;
|
code |= COMBINED_CHAR_BIT_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache the results in the model
|
// Cache the results in the model
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ describe('Linkifier', () => {
|
|||||||
let count = 0;
|
let count = 0;
|
||||||
linkifier.registerLinkMatcher(/test/, () => assert.fail(), {
|
linkifier.registerLinkMatcher(/test/, () => assert.fail(), {
|
||||||
validationCallback: (url, cb) => {
|
validationCallback: (url, cb) => {
|
||||||
count += 1;
|
count++;
|
||||||
if (count === 2) {
|
if (count === 2) {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ function formatError(input: string, output: string, expected: string): string {
|
|||||||
function addLineNumber(start: number, color: string): (s: string) => string {
|
function addLineNumber(start: number, color: string): (s: string) => string {
|
||||||
let counter = start || 0;
|
let counter = start || 0;
|
||||||
return (s: string): string => {
|
return (s: string): string => {
|
||||||
counter += 1;
|
counter++;
|
||||||
return '\x1b[33m' + (' ' + counter).slice(-2) + color + s;
|
return '\x1b[33m' + (' ' + counter).slice(-2) + color + s;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ export function clone<T>(val: T, depth: number = 5): T {
|
|||||||
|
|
||||||
for (const key in val) {
|
for (const key in val) {
|
||||||
// Recursively clone eack item unless we're at the maximum depth
|
// Recursively clone eack item unless we're at the maximum depth
|
||||||
clonedObject[key] = depth <= 1 ? val[key] : (val[key] ? clone(val[key], depth - 1) : val[key]);
|
clonedObject[key] = depth <= 1 ? val[key] : (val[key] && clone(val[key], depth - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return clonedObject as T;
|
return clonedObject as T;
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ describe('InputHandler', () => {
|
|||||||
optionsService.options.scrollback = 1;
|
optionsService.options.scrollback = 1;
|
||||||
bufferService.reset();
|
bufferService.reset();
|
||||||
});
|
});
|
||||||
it('SL (scrollLeft)', async () => {
|
it('SL (scrollLeft)', () => {
|
||||||
inputHandler.parseP('12345'.repeat(6));
|
inputHandler.parseP('12345'.repeat(6));
|
||||||
inputHandler.parseP('\x1b[ @');
|
inputHandler.parseP('\x1b[ @');
|
||||||
assert.deepEqual(getLines(bufferService, 6), ['12345', '2345', '2345', '2345', '2345', '2345']);
|
assert.deepEqual(getLines(bufferService, 6), ['12345', '2345', '2345', '2345', '2345', '2345']);
|
||||||
@@ -86,7 +86,7 @@ describe('InputHandler', () => {
|
|||||||
inputHandler.parseP('\x1b[2 @');
|
inputHandler.parseP('\x1b[2 @');
|
||||||
assert.deepEqual(getLines(bufferService, 6), ['12345', '5', '5', '5', '5', '5']);
|
assert.deepEqual(getLines(bufferService, 6), ['12345', '5', '5', '5', '5', '5']);
|
||||||
});
|
});
|
||||||
it('SR (scrollRight)', async () => {
|
it('SR (scrollRight)', () => {
|
||||||
inputHandler.parseP('12345'.repeat(6));
|
inputHandler.parseP('12345'.repeat(6));
|
||||||
inputHandler.parseP('\x1b[ A');
|
inputHandler.parseP('\x1b[ A');
|
||||||
assert.deepEqual(getLines(bufferService, 6), ['12345', ' 1234', ' 1234', ' 1234', ' 1234', ' 1234']);
|
assert.deepEqual(getLines(bufferService, 6), ['12345', ' 1234', ' 1234', ' 1234', ' 1234', ' 1234']);
|
||||||
@@ -95,7 +95,7 @@ describe('InputHandler', () => {
|
|||||||
inputHandler.parseP('\x1b[2 A');
|
inputHandler.parseP('\x1b[2 A');
|
||||||
assert.deepEqual(getLines(bufferService, 6), ['12345', ' 1', ' 1', ' 1', ' 1', ' 1']);
|
assert.deepEqual(getLines(bufferService, 6), ['12345', ' 1', ' 1', ' 1', ' 1', ' 1']);
|
||||||
});
|
});
|
||||||
it('insertColumns (DECIC)', async () => {
|
it('insertColumns (DECIC)', () => {
|
||||||
inputHandler.parseP('12345'.repeat(6));
|
inputHandler.parseP('12345'.repeat(6));
|
||||||
inputHandler.parseP('\x1b[3;3H');
|
inputHandler.parseP('\x1b[3;3H');
|
||||||
inputHandler.parseP('\x1b[\'}');
|
inputHandler.parseP('\x1b[\'}');
|
||||||
@@ -111,7 +111,7 @@ describe('InputHandler', () => {
|
|||||||
inputHandler.parseP('\x1b[2\'}');
|
inputHandler.parseP('\x1b[2\'}');
|
||||||
assert.deepEqual(getLines(bufferService, 6), ['12345', '12 3', '12 3', '12 3', '12 3', '12 3']);
|
assert.deepEqual(getLines(bufferService, 6), ['12345', '12 3', '12 3', '12 3', '12 3', '12 3']);
|
||||||
});
|
});
|
||||||
it('deleteColumns (DECDC)', async () => {
|
it('deleteColumns (DECDC)', () => {
|
||||||
inputHandler.parseP('12345'.repeat(6));
|
inputHandler.parseP('12345'.repeat(6));
|
||||||
inputHandler.parseP('\x1b[3;3H');
|
inputHandler.parseP('\x1b[3;3H');
|
||||||
inputHandler.parseP('\x1b[\'~');
|
inputHandler.parseP('\x1b[\'~');
|
||||||
@@ -137,7 +137,7 @@ describe('InputHandler', () => {
|
|||||||
bufferService.reset();
|
bufferService.reset();
|
||||||
});
|
});
|
||||||
describe('reverseWraparound set', () => {
|
describe('reverseWraparound set', () => {
|
||||||
it('should not reverse outside of scroll margins', async () => {
|
it('should not reverse outside of scroll margins', () => {
|
||||||
// prepare buffer content
|
// prepare buffer content
|
||||||
inputHandler.parseP('#####abcdefghijklmnopqrstuvwxy');
|
inputHandler.parseP('#####abcdefghijklmnopqrstuvwxy');
|
||||||
assert.deepEqual(getLines(bufferService, 6), ['#####', 'abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy']);
|
assert.deepEqual(getLines(bufferService, 6), ['#####', 'abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy']);
|
||||||
|
|||||||
Reference in New Issue
Block a user