| 26 | * - scroll position |
| 27 | */ |
| 28 | export class Buffer implements IBuffer { |
| 29 | public lines: CircularList<IBufferLine>; |
| 30 | public ydisp: number = 0; |
| 31 | public ybase: number = 0; |
| 32 | public y: number = 0; |
| 33 | public x: number = 0; |
| 34 | public scrollBottom: number; |
| 35 | public scrollTop: number; |
| 36 | public tabs: { [column: number]: boolean | undefined } = {}; |
| 37 | public savedY: number = 0; |
| 38 | public savedX: number = 0; |
| 39 | public savedCurAttrData = DEFAULT_ATTR_DATA.clone(); |
| 40 | public savedCharset: ICharset | undefined = DEFAULT_CHARSET; |
| 41 | public markers: Marker[] = []; |
| 42 | private _nullCell: ICellData = CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]); |
| 43 | private _whitespaceCell: ICellData = CellData.fromCharData([0, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_WIDTH, WHITESPACE_CELL_CODE]); |
| 44 | private _cols: number; |
| 45 | private _rows: number; |
| 46 | private _isClearing: boolean = false; |
| 47 | |
| 48 | constructor( |
| 49 | private _hasScrollback: boolean, |
| 50 | private _optionsService: IOptionsService, |
| 51 | private _bufferService: IBufferService |
| 52 | ) { |
| 53 | this._cols = this._bufferService.cols; |
| 54 | this._rows = this._bufferService.rows; |
| 55 | this.lines = new CircularList<IBufferLine>(this._getCorrectBufferLength(this._rows)); |
| 56 | this.scrollTop = 0; |
| 57 | this.scrollBottom = this._rows - 1; |
| 58 | this.setupTabStops(); |
| 59 | } |
| 60 | |
| 61 | public getNullCell(attr?: IAttributeData): ICellData { |
| 62 | if (attr) { |
| 63 | this._nullCell.fg = attr.fg; |
| 64 | this._nullCell.bg = attr.bg; |
| 65 | this._nullCell.extended = attr.extended; |
| 66 | } else { |
| 67 | this._nullCell.fg = 0; |
| 68 | this._nullCell.bg = 0; |
| 69 | this._nullCell.extended = new ExtendedAttrs(); |
| 70 | } |
| 71 | return this._nullCell; |
| 72 | } |
| 73 | |
| 74 | public getWhitespaceCell(attr?: IAttributeData): ICellData { |
| 75 | if (attr) { |
| 76 | this._whitespaceCell.fg = attr.fg; |
| 77 | this._whitespaceCell.bg = attr.bg; |
| 78 | this._whitespaceCell.extended = attr.extended; |
| 79 | } else { |
| 80 | this._whitespaceCell.fg = 0; |
| 81 | this._whitespaceCell.bg = 0; |
| 82 | this._whitespaceCell.extended = new ExtendedAttrs(); |
| 83 | } |
| 84 | return this._whitespaceCell; |
| 85 | } |
nothing calls this directly
no test coverage detected