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

Move some parts of renderer to browser #2239

Merged
merged 7 commits into from
Jun 16, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move char joiner registry to browser layer
  • Loading branch information
Tyriar committed Jun 16, 2019
commit e35d911fd18686311e201e7dc17ca279853029f2
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@
*/

import { assert } from 'chai';
import { ICharacterJoinerRegistry } from './Types';
import { CharacterJoinerRegistry } from './CharacterJoinerRegistry';
import { ICharacterJoinerRegistry } from 'browser/renderer/Types';
import { CharacterJoinerRegistry } from 'browser/renderer/CharacterJoinerRegistry';
import { BufferLine } from 'common/buffer/BufferLine';
import { IBufferLine } from 'common/Types';
import { CellData } from 'common/buffer/CellData';
@@ -26,7 +26,7 @@ describe('CharacterJoinerRegistry', () => {
lines.set(5, lineData([['a', 0x11111111], [' -> b -> c -> '], ['d', 0x22222222]]));
const line6 = lineData([['wi']]);
line6.resize(line6.length + 1, CellData.fromCharData([0, '¥', 2, '¥'.charCodeAt(0)]));
line6.resize(line6.length + 1, CellData.fromCharData([0, '', 0, null]));
line6.resize(line6.length + 1, CellData.fromCharData([0, '', 0, 0]));
let sub = lineData([['deemo']]);
let oldSize = line6.length;
line6.resize(oldSize + sub.length, CellData.fromCharData([0, '', 0, 0]));
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
*/

import { IBufferLine, ICellData, CharData } from 'common/Types';
import { ICharacterJoinerRegistry, ICharacterJoiner } from './Types';
import { ICharacterJoinerRegistry, ICharacterJoiner } from 'browser/renderer/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { WHITESPACE_CELL_CHAR, Content } from 'common/buffer/Constants';
import { CellData } from 'common/buffer/CellData';
@@ -90,7 +90,7 @@ export class CharacterJoinerRegistry implements ICharacterJoinerRegistry {
}

const line = this._bufferService.buffer.lines.get(row);
if (line.length === 0) {
if (!line || line.length === 0) {
return [];
}

11 changes: 11 additions & 0 deletions src/browser/renderer/Types.d.ts
Original file line number Diff line number Diff line change
@@ -45,3 +45,14 @@ export interface IRenderer extends IDisposable {
registerCharacterJoiner(handler: CharacterJoinerHandler): number;
deregisterCharacterJoiner(joinerId: number): boolean;
}

export interface ICharacterJoiner {
id: number;
handler: CharacterJoinerHandler;
}

export interface ICharacterJoinerRegistry {
registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
deregisterCharacterJoiner(joinerId: number): boolean;
getJoinedCharacters(row: number): [number, number][];
}
6 changes: 3 additions & 3 deletions src/renderer/Renderer.ts
Original file line number Diff line number Diff line change
@@ -6,11 +6,11 @@
import { TextRenderLayer } from './TextRenderLayer';
import { SelectionRenderLayer } from './SelectionRenderLayer';
import { CursorRenderLayer } from './CursorRenderLayer';
import { IRenderLayer, ICharacterJoinerRegistry } from './Types';
import { IRenderer, IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';
import { IRenderLayer } from './Types';
import { IRenderer, IRenderDimensions, CharacterJoinerHandler, ICharacterJoinerRegistry } from 'browser/renderer/Types';
import { ITerminal } from '../Types';
import { LinkRenderLayer } from './LinkRenderLayer';
import { CharacterJoinerRegistry } from '../renderer/CharacterJoinerRegistry';
import { CharacterJoinerRegistry } from '../browser/renderer/CharacterJoinerRegistry';
import { Disposable } from 'common/Lifecycle';
import { IColorSet } from 'browser/Types';
import { ICharSizeService } from 'browser/services/Services';
5 changes: 2 additions & 3 deletions src/renderer/TextRenderLayer.ts
Original file line number Diff line number Diff line change
@@ -3,15 +3,14 @@
* @license MIT
*/

import { ICharacterJoinerRegistry } from './Types';
import { IRenderDimensions } from 'browser/renderer/Types';
import { ICharacterJoinerRegistry, IRenderDimensions } from 'browser/renderer/Types';
import { ITerminal } from '../Types';
import { CharData, ICellData } from 'common/Types';
import { GridCache } from './GridCache';
import { BaseRenderLayer } from './BaseRenderLayer';
import { AttributeData } from 'common/buffer/AttributeData';
import { NULL_CELL_CODE, Content } from 'common/buffer/Constants';
import { JoinedCellData } from './CharacterJoinerRegistry';
import { JoinedCellData } from '../browser/renderer/CharacterJoinerRegistry';
import { IColorSet } from 'browser/Types';
import { CellData } from 'common/buffer/CellData';

13 changes: 1 addition & 12 deletions src/renderer/Types.d.ts
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
import { ITerminal } from '../Types';
import { IDisposable } from 'xterm';
import { IColorSet } from 'browser/Types';
import { IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';
import { IRenderDimensions, CharacterJoinerHandler, ICharacterJoiner } from 'browser/renderer/Types';

export interface IRenderLayer extends IDisposable {
/**
@@ -65,14 +65,3 @@ export interface IRenderLayer extends IDisposable {
*/
reset(terminal: ITerminal): void;
}

export interface ICharacterJoiner {
id: number;
handler: CharacterJoinerHandler;
}

export interface ICharacterJoinerRegistry {
registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
deregisterCharacterJoiner(joinerId: number): boolean;
getJoinedCharacters(row: number): [number, number][];
}