File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed
frontend/frame-editors/terminal-editor Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,7 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
307
307
} ) ;
308
308
conn . on ( "data" , this . handleDataFromProject ) ;
309
309
conn . once ( "ready" , ( ) => {
310
+ this . terminal . clear ( ) ;
310
311
delete this . last_geom ;
311
312
this . ignore_terminal_data = false ;
312
313
this . set_connection_status ( "connected" ) ;
@@ -706,6 +707,12 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
706
707
707
708
init_terminal_data ( ) : void {
708
709
this . terminal . onData ( ( data ) => {
710
+ if ( data == "\x1B[>0;276;0c" ) {
711
+ // this is a request for term capabilities, sending it just ends up
712
+ // not helping and putting "control codes" that users see in the terminal,
713
+ // which is very bad. So we ignore them.
714
+ return ;
715
+ }
709
716
if ( this . ignore_terminal_data && this . conn ?. state == "init" ) {
710
717
return ;
711
718
}
@@ -763,7 +770,11 @@ export class Terminal<T extends CodeEditorState = CodeEditorState> {
763
770
return ;
764
771
}
765
772
const { rows, cols } = geom ;
766
- if ( this . last_geom ?. rows === rows && this . last_geom ?. cols === cols ) {
773
+ if (
774
+ ! kick &&
775
+ this . last_geom ?. rows === rows &&
776
+ this . last_geom ?. cols === cols
777
+ ) {
767
778
return ;
768
779
}
769
780
this . last_geom = { rows, cols } ;
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ export class NatsTerminalConnection extends EventEmitter {
82
82
}
83
83
if ( typeof data != "string" ) {
84
84
if ( data . cmd == "size" ) {
85
- const { rows, cols } = data ;
85
+ const { rows, cols, kick } = data ;
86
86
if (
87
87
rows <= 0 ||
88
88
cols <= 0 ||
@@ -99,6 +99,7 @@ export class NatsTerminalConnection extends EventEmitter {
99
99
rows,
100
100
cols,
101
101
browser_id : webapp_client . browser_id ,
102
+ kick,
102
103
} ) ;
103
104
} catch {
104
105
// harmless to ignore
@@ -241,9 +242,6 @@ export class NatsTerminalConnection extends EventEmitter {
241
242
} ;
242
243
243
244
private setReady = async ( ) => {
244
- // wait until after render loop of terminal before allowing writing,
245
- // or we get corruption.
246
- await delay ( 1 ) ;
247
245
this . setState ( "running" ) ;
248
246
this . emit ( "ready" ) ;
249
247
} ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ interface TerminalApi {
29
29
rows : number ;
30
30
cols : number ;
31
31
browser_id : string ;
32
+ kick ?: boolean ;
32
33
} ) => Promise < void > ;
33
34
34
35
// sent from browser to project when this client is leaving.
You can’t perform that action at this time.
0 commit comments