@@ -13,6 +13,7 @@ import * as Strings from '../LocalizableStrings';
1313import { IEvent , EventEmitter } from 'common/EventEmitter' ;
1414import { AddonManager } from './AddonManager' ;
1515import { IParams } from 'common/parser/Types' ;
16+ import { BufferSet } from 'common/buffer/BufferSet' ;
1617
1718export class Terminal implements ITerminalApi {
1819 private _core : ITerminal ;
@@ -60,7 +61,7 @@ export class Terminal implements ITerminalApi {
6061 public get buffer ( ) : IBufferNamespaceApi {
6162 this . _checkProposedApi ( ) ;
6263 if ( ! this . _buffer ) {
63- return new BufferNamespaceApi ( this . _core . buffers ) ;
64+ this . _buffer = new BufferNamespaceApi ( this . _core ) ;
6465 }
6566 return this . _buffer ;
6667 }
@@ -249,21 +250,21 @@ class BufferNamespaceApi implements IBufferNamespaceApi {
249250 private _onBufferChange = new EventEmitter < IBufferApi > ( ) ;
250251 public get onBufferChange ( ) : IEvent < IBufferApi > { return this . _onBufferChange . event ; }
251252
252- constructor ( private _buffers : IBufferSet ) {
253- this . _normal = new BufferApiView ( this . _buffers . normal , 'normal' ) ;
254- this . _alternate = new BufferApiView ( this . _buffers . alt , 'alternate' ) ;
255- this . _buffers . onBufferActivate ( ( ) => this . _onBufferChange . fire ( this . active ) ) ;
253+ constructor ( private _core : ITerminal ) {
254+ this . _normal = new BufferApiView ( this . _core . buffers . normal , 'normal' ) ;
255+ this . _alternate = new BufferApiView ( this . _core . buffers . alt , 'alternate' ) ;
256+ this . _core . buffers . onBufferActivate ( ( ) => this . _onBufferChange . fire ( this . active ) ) ;
256257 }
257258 public get active ( ) : IBufferApi {
258- if ( this . _buffers . active === this . _buffers . normal ) { return this . normal ; }
259- if ( this . _buffers . active === this . _buffers . alt ) { return this . alternate ; }
259+ if ( this . _core . buffers . active === this . _core . buffers . normal ) { return this . normal ; }
260+ if ( this . _core . buffers . active === this . _core . buffers . alt ) { return this . alternate ; }
260261 throw new Error ( 'Active buffer is neither normal nor alternate' ) ;
261262 }
262263 public get normal ( ) : IBufferApi {
263- return this . _normal . init ( this . _buffers . normal ) ;
264+ return this . _normal . init ( this . _core . buffers . normal ) ;
264265 }
265266 public get alternate ( ) : IBufferApi {
266- return this . _alternate . init ( this . _buffers . alt ) ;
267+ return this . _alternate . init ( this . _core . buffers . alt ) ;
267268 }
268269}
269270
0 commit comments