@@ -827,24 +827,24 @@ export class YCodeCell
827
827
/**
828
828
* Remove text from a stream output.
829
829
*/
830
- removeStreamOutput ( index : number , start : number ) : void {
830
+ removeStreamOutput ( index : number , start : number , origin : any = null ) : void {
831
831
this . transact ( ( ) => {
832
832
const output = this . _youtputs . get ( index ) ;
833
833
const prevText = output . get ( 'text' ) as Y . Text ;
834
834
const length = prevText . length - start ;
835
835
prevText . delete ( start , length ) ;
836
- } , false ) ;
836
+ } , false , origin ) ;
837
837
}
838
838
839
839
/**
840
840
* Append text to a stream output.
841
841
*/
842
- appendStreamOutput ( index : number , text : string ) : void {
842
+ appendStreamOutput ( index : number , text : string , origin : any = null ) : void {
843
843
this . transact ( ( ) => {
844
844
const output = this . _youtputs . get ( index ) ;
845
845
const prevText = output . get ( 'text' ) as Y . Text ;
846
846
prevText . insert ( prevText . length , text ) ;
847
- } , false ) ;
847
+ } , false , origin ) ;
848
848
}
849
849
850
850
/**
@@ -895,6 +895,13 @@ export class YCodeCell
895
895
protected getChanges ( events : Y . YEvent < any > [ ] ) : Partial < CellChange > {
896
896
const changes = super . getChanges ( events ) ;
897
897
898
+ const streamOutputEvent = events . find (
899
+ event => event . path . length === 3 && event . path [ 0 ] === 'outputs' && event . path [ 2 ] === 'text'
900
+ ) ;
901
+ if ( streamOutputEvent ) {
902
+ changes . streamOutputChange = streamOutputEvent . changes . delta as any ;
903
+ }
904
+
898
905
const outputEvent = events . find (
899
906
event => event . target === this . ymodel . get ( 'outputs' )
900
907
) ;
0 commit comments