File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
capabilities/commandDetection
workbench/contrib/terminal/browser/media Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,6 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
112
112
return ;
113
113
}
114
114
115
- // TODO: Support multi-line prompts
116
-
117
115
this . _value = commandLine . substring ( this . _commandStartX ) ;
118
116
this . _cursorIndex = Math . max ( buffer . cursorX - this . _commandStartX , 0 ) ;
119
117
Original file line number Diff line number Diff line change @@ -382,7 +382,12 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
382
382
}
383
383
switch ( key ) {
384
384
case 'ContinuationPrompt' : {
385
- this . _updateContinuationPrompt ( value ) ;
385
+ // Exclude escape sequences and values between \[ and \]
386
+ const sanitizedValue = ( value
387
+ . replace ( / \x1b \[ [ 0 - 9 ; ] * m / g, '' )
388
+ . replace ( / \\ \[ .* ?\\ \] / g, '' )
389
+ ) ;
390
+ this . _updateContinuationPrompt ( sanitizedValue ) ;
386
391
return true ;
387
392
}
388
393
case 'Cwd' : {
@@ -411,8 +416,10 @@ export class ShellIntegrationAddon extends Disposable implements IShellIntegrati
411
416
}
412
417
413
418
private _updateContinuationPrompt ( value : string ) {
414
- const commandDetection = this . capabilities . get ( TerminalCapability . CommandDetection ) ;
415
- commandDetection ?. setContinuationPrompt ( value ) ;
419
+ if ( ! this . _terminal ) {
420
+ return ;
421
+ }
422
+ this . _createOrGetCommandDetection ( this . _terminal ) . setContinuationPrompt ( value ) ;
416
423
}
417
424
418
425
private _updateCwd ( value : string ) {
Original file line number Diff line number Diff line change @@ -162,6 +162,9 @@ __vsc_current_command=""
162
162
__vsc_nonce=" $VSCODE_NONCE "
163
163
unset VSCODE_NONCE
164
164
165
+ # Report continuation prompt
166
+ builtin printf " \e]633;P;ContinuationPrompt=$( echo " $PS2 " | sed ' s/\x1b/\\\\x1b/g' ) \a"
167
+
165
168
__vsc_prompt_start () {
166
169
builtin printf ' \e]633;A\a'
167
170
}
You can’t perform that action at this time.
0 commit comments