File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/vs/platform/terminal/common/capabilities Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ export class PartialCommandDetectionCapability implements IPartialCommandDetecti
34
34
private readonly _terminal : Terminal ,
35
35
) {
36
36
this . _terminal . onData ( e => this . _onData ( e ) ) ;
37
+ this . _terminal . parser . registerCsiHandler ( { final : 'J' } , params => {
38
+ if ( params . length >= 1 && ( params [ 0 ] === 2 || params [ 0 ] === 3 ) ) {
39
+ this . _clearCommandsInViewport ( ) ;
40
+ }
41
+ // We don't want to override xterm.js' default behavior, just augment it
42
+ return false ;
43
+ } ) ;
37
44
}
38
45
39
46
private _onData ( data : string ) : void {
@@ -54,4 +61,17 @@ export class PartialCommandDetectionCapability implements IPartialCommandDetecti
54
61
}
55
62
}
56
63
}
64
+
65
+ private _clearCommandsInViewport ( ) : void {
66
+ // Find the number of commands on the tail end of the array that are within the viewport
67
+ let count = 0 ;
68
+ for ( let i = this . _commands . length - 1 ; i >= 0 ; i -- ) {
69
+ if ( this . _commands [ i ] . line < this . _terminal . buffer . active . baseY ) {
70
+ break ;
71
+ }
72
+ count ++ ;
73
+ }
74
+ // Remove them
75
+ this . _commands . splice ( this . _commands . length - count , count ) ;
76
+ }
57
77
}
You can’t perform that action at this time.
0 commit comments