@@ -52,7 +52,11 @@ const enum ShellIntegrationOscPs {
52
52
/**
53
53
* Sequences by Cmder.
54
54
*/
55
- Cmder = 9
55
+ Cmder = 9 ,
56
+ /**
57
+ * Sequences by unknown terminal (maybe a command, rather than an indentifier).
58
+ */
59
+ Unknown7 = 7
56
60
}
57
61
58
62
/**
@@ -224,6 +228,7 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
224
228
this . _commonProtocolDisposables . push (
225
229
xterm . parser . registerOscHandler ( ShellIntegrationOscPs . FinalTerm , data => this . _handleFinalTermSequence ( data ) )
226
230
) ;
231
+ this . _register ( xterm . parser . registerOscHandler ( ShellIntegrationOscPs . Unknown7 , data => this . _doHandleUnknownSequence ( ShellIntegrationOscPs . Unknown7 , data ) ) ) ;
227
232
this . _ensureCapabilitiesOrAddFailureTelemetry ( ) ;
228
233
}
229
234
@@ -356,8 +361,6 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
356
361
}
357
362
switch ( key ) {
358
363
case 'Cwd' : {
359
- // TODO: Ideally we would also support the following to supplement our own:
360
- // - OSC 7 ; scheme://cwd ST (Unknown origin)
361
364
this . _updateCwd ( value ) ;
362
365
return true ;
363
366
}
@@ -432,6 +435,35 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
432
435
return false ;
433
436
}
434
437
438
+ /**
439
+ * Some escape sequences are not well known/documented, so we handle them in
440
+ * an ad-hoc/one-off manner. Also, note that in some cases the `ident` value
441
+ * itself acts like a command (not an terminal/emulator identifier). So, it
442
+ * seems logical to have a slack method that deals with such cases.
443
+ */
444
+ private _doHandleUnknownSequence ( ident : number , data : string ) : boolean {
445
+ if ( ! this . _terminal ) {
446
+ return false ;
447
+ }
448
+
449
+ const [ command ] = data . split ( ';' ) ;
450
+ switch ( ident ) {
451
+ case ShellIntegrationOscPs . Unknown7 : {
452
+ // Checking for: `OSC 7 ; scheme://cwd ST`
453
+ if ( command . startsWith ( 'scheme://' ) ) {
454
+ // TODO: I'm not sure `scheme` here is literal or can be `file` or something else.
455
+ // TODO: Possibly the path is URL-encoded, but I have no means to test it.
456
+ const cwd = command . substring ( 9 ) ;
457
+ this . _updateCwd ( cwd ) ;
458
+ return true ;
459
+ }
460
+ }
461
+ }
462
+
463
+ // Unrecognized sequence
464
+ return false ;
465
+ }
466
+
435
467
serialize ( ) : ISerializedCommandDetectionCapability {
436
468
if ( ! this . _terminal || ! this . capabilities . has ( TerminalCapability . CommandDetection ) ) {
437
469
return {
0 commit comments