Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert imports to non-relative, format all code using TS Server #2007

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.quoteStyle": "single",
"editor.formatOnSave": true
}
12 changes: 6 additions & 6 deletions src/AccessibilityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* @license MIT
*/

import * as Strings from './Strings';
import { ITerminal, IBuffer } from './Types';
import { isMac } from './common/Platform';
import { RenderDebouncer } from './ui/RenderDebouncer';
import { addDisposableDomListener } from './ui/Lifecycle';
import { Disposable } from './common/Lifecycle';
import { Disposable } from 'src/common/Lifecycle';
import { isMac } from 'src/common/Platform';
import * as Strings from 'src/Strings';
import { IBuffer, ITerminal } from 'src/Types';
import { addDisposableDomListener } from 'src/ui/Lifecycle';
import { RenderDebouncer } from 'src/ui/RenderDebouncer';

const MAX_ROWS_TO_READ = 20;

Expand Down
64 changes: 32 additions & 32 deletions src/Buffer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
*/

import { assert, expect } from 'chai';
import { ITerminal } from './Types';
import { Buffer, DEFAULT_ATTR_DATA } from './Buffer';
import { CircularList } from './common/CircularList';
import { MockTerminal, TestTerminal } from './ui/TestUtils.test';
import { BufferLine, CellData } from './BufferLine';
import { Buffer, DEFAULT_ATTR_DATA } from 'src/Buffer';
import { BufferLine, CellData } from 'src/BufferLine';
import { CircularList } from 'src/common/CircularList';
import { ITerminal } from 'src/Types';
import { MockTerminal, TestTerminal } from 'src/ui/TestUtils.test';

const INIT_COLS = 80;
const INIT_ROWS = 24;
Expand Down Expand Up @@ -387,10 +387,10 @@ describe('Buffer', () => {
buffer.resize(4, 3);
buffer.y = 2;
const firstLine = buffer.lines.get(0);
firstLine.set(0, [ null, 'a', 1, 'a'.charCodeAt(0) ]);
firstLine.set(1, [ null, 'b', 1, 'b'.charCodeAt(0) ]);
firstLine.set(2, [ null, 'c', 1, 'c'.charCodeAt(0) ]);
firstLine.set(3, [ null, '😁', 1, '😁'.charCodeAt(0) ]);
firstLine.set(0, [null, 'a', 1, 'a'.charCodeAt(0)]);
firstLine.set(1, [null, 'b', 1, 'b'.charCodeAt(0)]);
firstLine.set(2, [null, 'c', 1, 'c'.charCodeAt(0)]);
firstLine.set(3, [null, '😁', 1, '😁'.charCodeAt(0)]);
assert.equal(buffer.lines.length, 3);
assert.equal(buffer.lines.get(0).translateToString(), 'abc😁');
assert.equal(buffer.lines.get(1).translateToString(), ' ');
Expand Down Expand Up @@ -1091,13 +1091,13 @@ describe('Buffer', () => {
});
});

describe ('translateBufferLineToString', () => {
describe('translateBufferLineToString', () => {
it('should handle selecting a section of ascii text', () => {
const line = new BufferLine(4);
line.setCell(0, CellData.fromCharData([ null, 'a', 1, 'a'.charCodeAt(0)]));
line.setCell(1, CellData.fromCharData([ null, 'b', 1, 'b'.charCodeAt(0)]));
line.setCell(2, CellData.fromCharData([ null, 'c', 1, 'c'.charCodeAt(0)]));
line.setCell(3, CellData.fromCharData([ null, 'd', 1, 'd'.charCodeAt(0)]));
line.setCell(0, CellData.fromCharData([null, 'a', 1, 'a'.charCodeAt(0)]));
line.setCell(1, CellData.fromCharData([null, 'b', 1, 'b'.charCodeAt(0)]));
line.setCell(2, CellData.fromCharData([null, 'c', 1, 'c'.charCodeAt(0)]));
line.setCell(3, CellData.fromCharData([null, 'd', 1, 'd'.charCodeAt(0)]));
buffer.lines.set(0, line);

const str = buffer.translateBufferLineToString(0, true, 0, 2);
Expand All @@ -1106,9 +1106,9 @@ describe('Buffer', () => {

it('should handle a cut-off double width character by including it', () => {
const line = new BufferLine(3);
line.setCell(0, CellData.fromCharData([ null, '語', 2, 35486 ]));
line.setCell(1, CellData.fromCharData([ null, '', 0, null]));
line.setCell(2, CellData.fromCharData([ null, 'a', 1, 'a'.charCodeAt(0)]));
line.setCell(0, CellData.fromCharData([null, '語', 2, 35486]));
line.setCell(1, CellData.fromCharData([null, '', 0, null]));
line.setCell(2, CellData.fromCharData([null, 'a', 1, 'a'.charCodeAt(0)]));
buffer.lines.set(0, line);

const str1 = buffer.translateBufferLineToString(0, true, 0, 1);
Expand All @@ -1117,9 +1117,9 @@ describe('Buffer', () => {

it('should handle a zero width character in the middle of the string by not including it', () => {
const line = new BufferLine(3);
line.setCell(0, CellData.fromCharData([ null, '語', 2, '語'.charCodeAt(0) ]));
line.setCell(1, CellData.fromCharData([ null, '', 0, null]));
line.setCell(2, CellData.fromCharData([ null, 'a', 1, 'a'.charCodeAt(0)]));
line.setCell(0, CellData.fromCharData([null, '語', 2, '語'.charCodeAt(0)]));
line.setCell(1, CellData.fromCharData([null, '', 0, null]));
line.setCell(2, CellData.fromCharData([null, 'a', 1, 'a'.charCodeAt(0)]));
buffer.lines.set(0, line);

const str0 = buffer.translateBufferLineToString(0, true, 0, 1);
Expand All @@ -1134,8 +1134,8 @@ describe('Buffer', () => {

it('should handle single width emojis', () => {
const line = new BufferLine(2);
line.setCell(0, CellData.fromCharData([ null, '😁', 1, '😁'.charCodeAt(0) ]));
line.setCell(1, CellData.fromCharData([ null, 'a', 1, 'a'.charCodeAt(0)]));
line.setCell(0, CellData.fromCharData([null, '😁', 1, '😁'.charCodeAt(0)]));
line.setCell(1, CellData.fromCharData([null, 'a', 1, 'a'.charCodeAt(0)]));
buffer.lines.set(0, line);

const str1 = buffer.translateBufferLineToString(0, true, 0, 1);
Expand All @@ -1147,8 +1147,8 @@ describe('Buffer', () => {

it('should handle double width emojis', () => {
const line = new BufferLine(2);
line.setCell(0, CellData.fromCharData([ null, '😁', 2, '😁'.charCodeAt(0) ]));
line.setCell(1, CellData.fromCharData([ null, '', 0, null]));
line.setCell(0, CellData.fromCharData([null, '😁', 2, '😁'.charCodeAt(0)]));
line.setCell(1, CellData.fromCharData([null, '', 0, null]));
buffer.lines.set(0, line);

const str1 = buffer.translateBufferLineToString(0, true, 0, 1);
Expand All @@ -1158,9 +1158,9 @@ describe('Buffer', () => {
assert.equal(str2, '😁');

const line2 = new BufferLine(3);
line2.setCell(0, CellData.fromCharData([ null, '😁', 2, '😁'.charCodeAt(0) ]));
line2.setCell(1, CellData.fromCharData([ null, '', 0, null]));
line2.setCell(2, CellData.fromCharData([ null, 'a', 1, 'a'.charCodeAt(0)]));
line2.setCell(0, CellData.fromCharData([null, '😁', 2, '😁'.charCodeAt(0)]));
line2.setCell(1, CellData.fromCharData([null, '', 0, null]));
line2.setCell(2, CellData.fromCharData([null, 'a', 1, 'a'.charCodeAt(0)]));
buffer.lines.set(0, line2);

const str3 = buffer.translateBufferLineToString(0, true, 0, 3);
Expand All @@ -1171,7 +1171,7 @@ describe('Buffer', () => {
let terminal: TestTerminal;

beforeEach(() => {
terminal = new TestTerminal({rows: 5, cols: 10, scrollback: 5});
terminal = new TestTerminal({ rows: 5, cols: 10, scrollback: 5 });
});

it('multiline ascii', () => {
Expand Down Expand Up @@ -1346,7 +1346,7 @@ describe('Buffer', () => {

it('test fully wrapped buffer up to last char with full width odd', () => {
const input = 'a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301'
+ 'a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301';
+ 'a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301a¥\u0301';
terminal.writeSync(input);
const s = terminal.buffer.iterator(true).next().content;
assert.equal(input, s);
Expand All @@ -1369,9 +1369,9 @@ describe('Buffer', () => {
assert.equal(s, Array(terminal.getOption('tabStopWidth') + 1).join(' ') + 'https://google.de');
});
});
describe('BufferStringIterator', function(): void {
it('iterator does not overflow buffer limits', function(): void {
const terminal = new TestTerminal({rows: 5, cols: 10, scrollback: 5});
describe('BufferStringIterator', function (): void {
it('iterator does not overflow buffer limits', function (): void {
const terminal = new TestTerminal({ rows: 5, cols: 10, scrollback: 5 });
const data = [
'aaaaaaaaaa',
'aaaaaaaaa\n',
Expand Down
16 changes: 8 additions & 8 deletions src/Buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* @license MIT
*/

import { CircularList, IInsertEvent, IDeleteEvent } from './common/CircularList';
import { ITerminal, IBuffer, IBufferLine, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult, ICellData, IAttributeData } from './Types';
import { EventEmitter } from './common/EventEmitter';
import { AttributeData, BufferLine, CellData } from 'src/BufferLine';
import { getWrappedLineTrimmedLength, reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths } from 'src/BufferReflow';
import { CircularList, IDeleteEvent, IInsertEvent } from 'src/common/CircularList';
import { EventEmitter } from 'src/common/EventEmitter';
import { DEFAULT_COLOR } from 'src/renderer/atlas/Types';
import { BufferIndex, IAttributeData, IBuffer, IBufferLine, IBufferStringIterator, IBufferStringIteratorResult, ICellData, ITerminal } from 'src/Types';
import { IMarker } from 'xterm';
import { BufferLine, CellData, AttributeData } from './BufferLine';
import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from './BufferReflow';
import { DEFAULT_COLOR } from './renderer/atlas/Types';


export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);
Expand Down Expand Up @@ -669,7 +669,7 @@ export class Marker extends EventEmitter implements IMarker {
export class BufferStringIterator implements IBufferStringIterator {
private _current: number;

constructor (
constructor(
private _buffer: IBuffer,
private _trimRight: boolean,
private _startIndex: number = 0,
Expand Down Expand Up @@ -707,6 +707,6 @@ export class BufferStringIterator implements IBufferStringIterator {
result += this._buffer.translateBufferLineToString(i, this._trimRight);
}
this._current = range.last + 1;
return {range: range, content: result};
return { range: range, content: result };
}
}
Loading