@@ -79,6 +79,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
7979 private _rowIndex : number = 0 ;
8080 private _allRows : string [ ] = new Array < string > ( ) ;
8181 private _currentRow : string = '' ;
82+ private _nullCellCount : number = 0 ;
8283 private _sgrSeq : number [ ] = [ ] ;
8384
8485 constructor ( buffer : IBuffer ) {
@@ -92,6 +93,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
9293 protected _lineEnd ( row : number ) : void {
9394 this . _allRows [ this . _rowIndex ++ ] = this . _currentRow ;
9495 this . _currentRow = '' ;
96+ this . _nullCellCount = 0 ;
9597 }
9698
9799 protected _cellFlagsChanged ( cell : IBufferCell , oldCell : IBufferCell , row : number , col : number ) : void {
@@ -133,6 +135,15 @@ class StringSerializeHandler extends BaseSerializeHandler {
133135 }
134136
135137 protected _nextCell ( cell : IBufferCell , oldCell : IBufferCell , row : number , col : number ) : void {
138+ // Count number of null cells encountered after the last non-null cell and move the cursor
139+ // if a non-null cell is found (eg. \t or cursor move)
140+ if ( cell . char === '' ) {
141+ this . _nullCellCount ++ ;
142+ } else if ( this . _nullCellCount > 0 ) {
143+ this . _currentRow += `\x1b[${ this . _nullCellCount } C` ;
144+ this . _nullCellCount = 0 ;
145+ }
146+
136147 const fgChanged = ! cell . equalFg ( oldCell ) ;
137148 const bgChanged = ! cell . equalBg ( oldCell ) ;
138149 const flagsChanged = ! cell . equalFlags ( oldCell ) ;
0 commit comments