@@ -7,8 +7,10 @@ import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from './Buffer';
7
7
8
8
/**
9
9
* Class representing a terminal line.
10
+ *
11
+ * @deprecated to be removed with one of the next releases
10
12
*/
11
- export class BufferLine implements IBufferLine {
13
+ export class BufferLineJSArray implements IBufferLine {
12
14
protected _data : CharData [ ] ;
13
15
public isWrapped = false ;
14
16
public length : number ;
@@ -94,14 +96,14 @@ export class BufferLine implements IBufferLine {
94
96
}
95
97
}
96
98
97
- public copyFrom ( line : BufferLine ) : void {
99
+ public copyFrom ( line : BufferLineJSArray ) : void {
98
100
this . _data = line . _data . slice ( 0 ) ;
99
101
this . length = line . length ;
100
102
this . isWrapped = line . isWrapped ;
101
103
}
102
104
103
105
public clone ( ) : IBufferLine {
104
- const newLine = new BufferLine ( 0 ) ;
106
+ const newLine = new BufferLineJSArray ( 0 ) ;
105
107
newLine . copyFrom ( this ) ;
106
108
return newLine ;
107
109
}
@@ -119,17 +121,8 @@ const enum Cell {
119
121
120
122
/**
121
123
* Typed array based bufferline implementation.
122
- * Note: Unlike the JS variant the access to the data
123
- * via set/get is always a copy action.
124
- * Sloppy ref style coding will not work anymore:
125
- * line = new BufferLine(10);
126
- * char = line.get(0); // char is a copy
127
- * char[some_index] = 123; // will not update the line
128
- * line.set(0, ch); // do this to update line data
129
- * TODO:
130
- * - provide getData/setData to directly access the data
131
124
*/
132
- export class BufferLineTypedArray implements IBufferLine {
125
+ export class BufferLine implements IBufferLine {
133
126
protected _data : Uint32Array | null = null ;
134
127
protected _combined : { [ index : number ] : string } = { } ;
135
128
public length : number ;
@@ -248,7 +241,7 @@ export class BufferLineTypedArray implements IBufferLine {
248
241
}
249
242
250
243
/** alter to a full copy of line */
251
- public copyFrom ( line : BufferLineTypedArray ) : void {
244
+ public copyFrom ( line : BufferLine ) : void {
252
245
if ( this . length !== line . length ) {
253
246
this . _data = new Uint32Array ( line . _data ) ;
254
247
} else {
@@ -265,7 +258,7 @@ export class BufferLineTypedArray implements IBufferLine {
265
258
266
259
/** create a new clone */
267
260
public clone ( ) : IBufferLine {
268
- const newLine = new BufferLineTypedArray ( 0 ) ;
261
+ const newLine = new BufferLine ( 0 ) ;
269
262
// creation of new typed array from another is actually pretty slow :(
270
263
// still faster than copying values one by one
271
264
newLine . _data = new Uint32Array ( this . _data ) ;
0 commit comments