Skip to content

Commit

Permalink
Add todo to split this issue on the tasks and preparing to merge with x…
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrienkoAleksandr committed Jun 21, 2017
1 parent 3774b53 commit 0101977
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/Buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ export class Buffer {
private _ydisp: number;
private _y: number;
private _x: number;
private _tabs: any;
private _tabs: any; // todo check applying custom tabs size to the alt buffer...
private _diff: number; // todo think about implementation
// Todo cursorHidden: boolean; todo seems should be moved to the buffer and restored after switching from alt buffer to normal buffer(and otherwise) => 1047, 47, 1049 in the InputHandler!!!!
// Todo cursorState: number; todo seems should be moved to the buffer and restored after switching from alt buffer to normal buffer(and otherwise) => 1047, 47, 1049 in the InputHandler!!!!

constructor(private terminal: ITerminal) {
this._lines = new CircularList(this.terminal.scrollback);
}

public get lines(): CircularList {
public get lines(): CircularList<string> {
return this._lines;
}
}
10 changes: 9 additions & 1 deletion src/BufferSet.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
/**
* @license MIT
* @author Paris Kasidiaris
* paris@sourcelair.com
*/

import { ITerminal } from './Interfaces';
import { Buffer } from './Buffer';
import {EventEmitter} from './EventEmitter';

export class BufferSet {
export class BufferSet extends EventEmitter {
private _normal: Buffer;
private _alt: Buffer;
private _activeBuffer: Buffer;

constructor(private _terminal: ITerminal) {
super();
this._normal = new Buffer(this._terminal);
this._alt = new Buffer(this._terminal);
this._activeBuffer = this._normal;
Expand All @@ -36,9 +40,13 @@ export class BufferSet {

public activateNormalBuffer(): void {
this._activeBuffer = this._normal;
this.resetTerminal();
this.emit('activate', this._normal);
}

public activateAltBuffer(): void {
this._activeBuffer = this._normal;
this.resetTerminal();
this.emit('activate', this._normal);
}
}
22 changes: 14 additions & 8 deletions src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@ export interface ITerminal {
selectionContainer: HTMLElement;
charMeasure: ICharMeasure;
textarea: HTMLTextAreaElement;
ybase: number;
ydisp: number;
normal: any;
lines: ICircularList<string>;
ybase: number; // Todo should be deleted from here, because it will be used from buffer. @parisk part
ydisp: number; // Todo should be deleted from here, because it will be used from buffer. @parisk part
lines: ICircularList<string>; // Todo should be moved to buffer at all!!! @parisk part
rows: number;
cols: number;
diff: number;
diff: number; // todo should be calculated and moved to the buffer, but how!!!!!
browser: IBrowser;
writeBuffer: string[];
children: HTMLElement[];
cursorHidden: boolean;
cursorState: number;
cursorHidden: boolean; // todo seems should be moved to the buffer and restored after switching from alt buffer to normal buffer(and otherwise) => 1047, 47, 1049 in the InputHandler!!!!
cursorState: number; // todo seems should be moved to the buffer and restored after switching from alt buffer to normal buffer(and otherwise) => 1047, 47, 1049 in the InputHandler!!!!
x: number;
y: number;
defAttr: number;
defAttr: number; // todo hmm... check maybe it should be moved to the buffer and restored after switching from alt buffer to normal buffer(and otherwise) => 1047, 47, 1049 in the InputHandler!!!!? We need to find testcases to check this stuff, maybe it's will fixes some bugs with background colors or so on.
scrollback: number;
// buffer and viewport @parisk changes. I need it.
buffer: any; // This should be a `Buffer` class, but it would result in circular dependency
// Todo we need think about it. Seems Alt buffer doesn't use scroll(in the xterm.js we uses ViewPort for alt screen, but I believe it's a mistake, which produces hard bugs.), so I'm not sure that we need scrollPort for alt buffer at all... But we exactly need it for normal buffer... Maybe this field should not be in the buffer and we need stay it in the ITerminal.
viewport: any;

/**
* Emit the 'data' event and populate the given data.
Expand All @@ -51,6 +54,9 @@ export interface ITerminal {
log(text: string): void;
emit(event: string, data: any);
blankLine(cur: any, isWrapped: boolean); // todo cur should be some array
// reset() and showCursor() @parisk changes. I need it.
reset(): void;
showCursor(): void;
}

export interface ISelectionManager {
Expand Down

0 comments on commit 0101977

Please sign in to comment.