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

Merge core into common, rename ui to browser #2207

Merged
merged 3 commits into from
Jun 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions demo/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ const clientConfig = {
extensions: [ '.tsx', '.ts', '.js' ],
alias: {
common: path.resolve('./out/common'),
core: path.resolve('./out/core'),
ui: path.resolve('./out/ui')
browser: path.resolve('./out/browser')
}
},
output: {
Expand Down
6 changes: 3 additions & 3 deletions src/AccessibilityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
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 { RenderDebouncer } from 'browser/RenderDebouncer';
import { addDisposableDomListener } from 'browser/Lifecycle';
import { Disposable } from 'common/Lifecycle';
import { ScreenDprMonitor } from 'ui/ScreenDprMonitor';
import { ScreenDprMonitor } from 'browser/ScreenDprMonitor';
import { IRenderDimensions } from './renderer/Types';

const MAX_ROWS_TO_READ = 20;
Expand Down
2 changes: 1 addition & 1 deletion src/Buffer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ITerminal } from './Types';
import { Buffer } from './Buffer';
import { CircularList } from 'common/CircularList';
import { MockTerminal, TestTerminal } from './TestUtils.test';
import { BufferLine, CellData, DEFAULT_ATTR_DATA } from 'core/buffer/BufferLine';
import { BufferLine, CellData, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';

const INIT_COLS = 80;
const INIT_ROWS = 24;
Expand Down
8 changes: 4 additions & 4 deletions src/Buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import { CircularList, IInsertEvent } from 'common/CircularList';
import { ITerminal, IBuffer, BufferIndex, IBufferStringIterator, IBufferStringIteratorResult } from './Types';
import { IBufferLine, ICellData, IAttributeData } from 'core/Types';
import { BufferLine, CellData, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX, DEFAULT_ATTR_DATA } from 'core/buffer/BufferLine';
import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from 'core/buffer/BufferReflow';
import { Marker } from 'core/buffer/Marker';
import { IBufferLine, ICellData, IAttributeData } from 'common/Types';
import { BufferLine, CellData, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { reflowLargerApplyNewLayout, reflowLargerCreateNewLayout, reflowLargerGetLinesToRemove, reflowSmallerGetNewLineLengths, getWrappedLineTrimmedLength } from 'common/buffer/BufferReflow';
import { Marker } from 'common/buffer/Marker';

export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1

Expand Down
2 changes: 1 addition & 1 deletion src/BufferSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { ITerminal, IBufferSet, IBuffer } from './Types';
import { IAttributeData } from 'core/Types';
import { IAttributeData } from 'common/Types';
import { Buffer } from './Buffer';
import { EventEmitter2, IEvent } from 'common/EventEmitter2';

Expand Down
2 changes: 1 addition & 1 deletion src/CompositionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { ITerminal } from './Types';
import { ICharSizeService } from 'ui/services/Services';
import { ICharSizeService } from 'browser/services/Services';

interface IPosition {
start: number;
Expand Down
4 changes: 2 additions & 2 deletions src/InputHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { assert, expect } from 'chai';
import { InputHandler } from './InputHandler';
import { MockInputHandlingTerminal, TestTerminal } from './TestUtils.test';
import { Terminal } from './Terminal';
import { IBufferLine } from 'core/Types';
import { CellData, Attributes, AttributeData, DEFAULT_ATTR_DATA } from 'core/buffer/BufferLine';
import { IBufferLine } from 'common/Types';
import { CellData, Attributes, AttributeData, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';

describe('InputHandler', () => {
describe('save and restore cursor', () => {
Expand Down
10 changes: 5 additions & 5 deletions src/InputHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

import { IInputHandler, IInputHandlingTerminal } from './Types';
import { C0, C1 } from 'common/data/EscapeSequences';
import { CHARSETS, DEFAULT_CHARSET } from 'core/data/Charsets';
import { CHARSETS, DEFAULT_CHARSET } from 'common/data/Charsets';
import { wcwidth } from './common/CharWidth';
import { EscapeSequenceParser } from 'core/parser/EscapeSequenceParser';
import { EscapeSequenceParser } from 'common/parser/EscapeSequenceParser';
import { IDisposable } from 'xterm';
import { Disposable } from 'common/Lifecycle';
import { concat } from 'common/TypedArrayUtils';
import { StringToUtf32, stringFromCodePoint, utf32ToString, Utf8ToUtf32 } from 'core/input/TextDecoder';
import { CellData, Attributes, FgFlags, BgFlags, AttributeData, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR_DATA } from 'core/buffer/BufferLine';
import { StringToUtf32, stringFromCodePoint, utf32ToString, Utf8ToUtf32 } from 'common/input/TextDecoder';
import { CellData, Attributes, FgFlags, BgFlags, AttributeData, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { EventEmitter2, IEvent } from 'common/EventEmitter2';
import { IParsingState, IDcsHandler, IEscapeSequenceParser } from 'core/parser/Types';
import { IParsingState, IDcsHandler, IEscapeSequenceParser } from 'common/parser/Types';

/**
* Map collect to glevel. Used in `selectCharset`.
Expand Down
4 changes: 2 additions & 2 deletions src/Linkifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import { assert } from 'chai';
import { IMouseZoneManager, IMouseZone, ILinkMatcher, ITerminal } from './Types';
import { IBufferLine } from 'core/Types';
import { IBufferLine } from 'common/Types';
import { Linkifier } from './Linkifier';
import { MockBuffer, MockTerminal, TestTerminal } from './TestUtils.test';
import { CircularList } from 'common/CircularList';
import { BufferLine, CellData } from 'core/buffer/BufferLine';
import { BufferLine, CellData } from 'common/buffer/BufferLine';

class TestLinkifier extends Linkifier {
constructor(terminal: ITerminal) {
Expand Down
3 changes: 3 additions & 0 deletions src/MouseHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @license MIT
*/

import jsdom = require('jsdom');
import { assert } from 'chai';
import { MouseHelper } from './MouseHelper';
import { MockRenderer, MockCharSizeService } from './TestUtils.test';
Expand All @@ -11,9 +12,11 @@ const CHAR_WIDTH = 10;
const CHAR_HEIGHT = 20;

describe('MouseHelper.getCoords', () => {
let document: Document;
let mouseHelper: MouseHelper;

beforeEach(() => {
document = new jsdom.JSDOM('').window.document;
const renderer = new MockRenderer();
renderer.dimensions = <any>{
actualCellWidth: CHAR_WIDTH,
Expand Down
2 changes: 1 addition & 1 deletion src/MouseHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { IMouseHelper } from './Types';
import { RenderCoordinator } from './renderer/RenderCoordinator';
import { ICharSizeService } from 'ui/services/Services';
import { ICharSizeService } from 'browser/services/Services';

export class MouseHelper implements IMouseHelper {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion src/MouseZoneManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { ITerminal, IMouseZoneManager, IMouseZone } from './Types';
import { Disposable } from 'common/Lifecycle';
import { addDisposableDomListener } from 'ui/Lifecycle';
import { addDisposableDomListener } from 'browser/Lifecycle';

const HOVER_DURATION = 500;

Expand Down
4 changes: 2 additions & 2 deletions src/SelectionManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { SelectionManager, SelectionMode } from './SelectionManager';
import { SelectionModel } from './SelectionModel';
import { BufferSet } from './BufferSet';
import { ITerminal, IBuffer } from './Types';
import { IBufferLine } from 'core/Types';
import { IBufferLine } from 'common/Types';
import { MockTerminal, MockCharSizeService } from './TestUtils.test';
import { BufferLine, CellData } from 'core/buffer/BufferLine';
import { BufferLine, CellData } from 'common/buffer/BufferLine';

class TestMockTerminal extends MockTerminal {
emit(event: string, data: any): void {}
Expand Down
6 changes: 3 additions & 3 deletions src/SelectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
*/

import { ITerminal, ISelectionManager, IBuffer, ISelectionRedrawRequestEvent } from './Types';
import { IBufferLine } from 'core/Types';
import { IBufferLine } from 'common/Types';
import { MouseHelper } from './MouseHelper';
import * as Browser from 'common/Platform';
import { SelectionModel } from './SelectionModel';
import { AltClickHandler } from './handlers/AltClickHandler';
import { CellData } from 'core/buffer/BufferLine';
import { CellData } from 'common/buffer/BufferLine';
import { IDisposable } from 'xterm';
import { EventEmitter2, IEvent } from 'common/EventEmitter2';
import { ICharSizeService } from 'ui/services/Services';
import { ICharSizeService } from 'browser/services/Services';

/**
* The number of pixels the mouse needs to be above or below the viewport in
Expand Down
2 changes: 1 addition & 1 deletion src/Terminal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { assert, expect } from 'chai';
import { Terminal } from './Terminal';
import { MockViewport, MockCompositionHelper, MockRenderer } from './TestUtils.test';
import { CellData, DEFAULT_ATTR_DATA } from 'core/buffer/BufferLine';
import { CellData, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';

const INIT_COLS = 80;
const INIT_ROWS = 24;
Expand Down
15 changes: 7 additions & 8 deletions src/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { Renderer } from './renderer/Renderer';
import { Linkifier } from './Linkifier';
import { SelectionManager } from './SelectionManager';
import * as Browser from 'common/Platform';
import { addDisposableDomListener } from 'ui/Lifecycle';
import { addDisposableDomListener } from 'browser/Lifecycle';
import * as Strings from './Strings';
import { MouseHelper } from './MouseHelper';
import { SoundManager } from './SoundManager';
Expand All @@ -44,18 +44,17 @@ import { AccessibilityManager } from './AccessibilityManager';
import { ITheme, IMarker, IDisposable, ISelectionPosition } from 'xterm';
import { removeTerminalFromCache } from './renderer/atlas/CharAtlasCache';
import { DomRenderer } from './renderer/dom/DomRenderer';
import { IKeyboardEvent } from 'common/Types';
import { evaluateKeyboardEvent } from 'core/input/Keyboard';
import { KeyboardResultType, ICharset, IBufferLine, IAttributeData } from 'core/Types';
import { IKeyboardEvent, KeyboardResultType, ICharset, IBufferLine, IAttributeData } from 'common/Types';
import { evaluateKeyboardEvent } from 'common/input/Keyboard';
import { EventEmitter2, IEvent } from 'common/EventEmitter2';
import { Attributes, DEFAULT_ATTR_DATA } from 'core/buffer/BufferLine';
import { Attributes, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { applyWindowsMode } from './WindowsMode';
import { ColorManager } from 'ui/ColorManager';
import { ColorManager } from 'browser/ColorManager';
import { RenderCoordinator } from './renderer/RenderCoordinator';
import { IOptionsService } from 'common/services/Services';
import { OptionsService } from 'common/services/OptionsService';
import { ICharSizeService } from 'ui/services/Services';
import { CharSizeService } from 'ui/services/CharSizeService';
import { ICharSizeService } from 'browser/services/Services';
import { CharSizeService } from 'browser/services/CharSizeService';

// Let it work inside Node.js for automated testing purposes.
const document = (typeof window !== 'undefined') ? window.document : null;
Expand Down
2 changes: 1 addition & 1 deletion src/Terminal2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as path from 'path';
import * as pty from 'node-pty';
import { Terminal } from './Terminal';
import { IViewport } from './Types';
import { CellData, WHITESPACE_CELL_CHAR } from 'core/buffer/BufferLine';
import { CellData, WHITESPACE_CELL_CHAR } from 'common/buffer/BufferLine';

class TestTerminal extends Terminal {
innerWrite(): void { this._innerWrite(); }
Expand Down
9 changes: 4 additions & 5 deletions src/TestUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@

import { IRenderer, IRenderDimensions } from './renderer/Types';
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferStringIterator } from './Types';
import { IBufferLine, ICellData, IAttributeData } from 'core/Types';
import { ICircularList, XtermListener } from 'common/Types';
import { IBufferLine, ICellData, IAttributeData, ICircularList, XtermListener } from 'common/Types';
import { Buffer } from './Buffer';
import * as Browser from 'common/Platform';
import { IDisposable, IMarker, IEvent, ISelectionPosition } from 'xterm';
import { Terminal } from './Terminal';
import { AttributeData } from 'core/buffer/BufferLine';
import { IColorManager, IColorSet } from 'ui/Types';
import { AttributeData } from 'common/buffer/BufferLine';
import { IColorManager, IColorSet } from 'browser/Types';
import { IOptionsService } from 'common/services/Services';
import { ICharSizeService } from 'ui/services/Services';
import { ICharSizeService } from 'browser/services/Services';

export class TestTerminal extends Terminal {
writeSync(data: string): void {
Expand Down
5 changes: 2 additions & 3 deletions src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
*/

import { ITerminalOptions as IPublicTerminalOptions, IEventEmitter, IDisposable, IMarker, ISelectionPosition } from 'xterm';
import { ICharset, IAttributeData, ICellData, IBufferLine, CharData } from 'core/Types';
import { ICircularList } from 'common/Types';
import { ICharset, IAttributeData, ICellData, IBufferLine, CharData, ICircularList } from 'common/Types';
import { IEvent } from 'common/EventEmitter2';
import { IColorSet } from 'ui/Types';
import { IColorSet } from 'browser/Types';
import { IOptionsService } from 'common/services/Services';

export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/Viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import { ITerminal, IViewport } from './Types';
import { Disposable } from 'common/Lifecycle';
import { addDisposableDomListener } from 'ui/Lifecycle';
import { IColorSet } from 'ui/Types';
import { addDisposableDomListener } from 'browser/Lifecycle';
import { IColorSet } from 'browser/Types';
import { IRenderDimensions } from './renderer/Types';
import { ICharSizeService } from 'ui/services/Services';
import { ICharSizeService } from 'browser/services/Services';

const FALLBACK_SCROLL_BAR_WIDTH = 15;

Expand Down
2 changes: 1 addition & 1 deletion src/WindowsMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { IDisposable } from 'xterm';
import { ITerminal } from './Types';
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'core/buffer/BufferLine';
import { CHAR_DATA_CODE_INDEX, NULL_CELL_CODE, WHITESPACE_CELL_CODE } from 'common/buffer/BufferLine';

export function applyWindowsMode(terminal: ITerminal): IDisposable {
// Winpty does not support wraparound mode which means that lines will never
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import jsdom = require('jsdom');
import { assert } from 'chai';
import { ColorManager } from 'ui/ColorManager';
import { ColorManager } from 'browser/ColorManager';

describe('ColorManager', () => {
let cm: ColorManager;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ColorManager.ts → src/browser/ColorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @license MIT
*/

import { IColorManager, IColor, IColorSet, ITheme } from 'ui/Types';
import { IColorManager, IColor, IColorSet, ITheme } from 'browser/Types';

const DEFAULT_FOREGROUND = fromHex('#ffffff');
const DEFAULT_BACKGROUND = fromHex('#000000');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { IOptionsService } from 'common/services/Services';
import { IEvent, EventEmitter2 } from 'common/EventEmitter2';
import { ICharSizeService } from 'ui/services/Services';
import { ICharSizeService } from 'browser/services/Services';

export class CharSizeService implements ICharSizeService {
public width: number = 0;
Expand Down
File renamed without changes.
File renamed without changes.