@@ -733,14 +733,14 @@ class WindowsPtyHeuristics extends Disposable {
733
733
// Adjust the prompt start marker to the command start marker
734
734
this . _logService . debug ( 'CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted promptStart' , `${ this . _capability . currentCommand . promptStartMarker ?. line } -> ${ this . _capability . currentCommand . commandStartMarker . line } ` ) ;
735
735
this . _capability . currentCommand . promptStartMarker ?. dispose ( ) ;
736
- this . _capability . currentCommand . promptStartMarker = cloneMarker ( this . _terminal , this . _capability . currentCommand . commandStartMarker , - ( this . _capability . currentCommand . promptHeight ?? 0 ) ) ;
736
+ this . _capability . currentCommand . promptStartMarker = cloneMarker ( this . _terminal , this . _capability . currentCommand . commandStartMarker , - ( ( this . _capability . currentCommand . promptHeight ?? 1 ) - 1 ) ) ;
737
737
738
738
// Adjust the last command if it's not in the same position as the following
739
739
// prompt start marker
740
740
const lastCommand = this . _capability . commands . at ( - 1 ) ;
741
741
if ( lastCommand && this . _capability . currentCommand . commandStartMarker . line !== lastCommand . endMarker ?. line ) {
742
742
lastCommand . endMarker ?. dispose ( ) ;
743
- lastCommand . endMarker = cloneMarker ( this . _terminal , this . _capability . currentCommand . commandStartMarker , - ( this . _capability . currentCommand . promptHeight ?? 0 ) ) ;
743
+ lastCommand . endMarker = cloneMarker ( this . _terminal , this . _capability . currentCommand . commandStartMarker , - ( ( this . _capability . currentCommand . promptHeight ?? 1 ) - 1 ) ) ;
744
744
}
745
745
746
746
// use the regex to set the position as it's possible input has occurred
@@ -1070,5 +1070,5 @@ function getXtermLineContent(buffer: IBuffer, lineStart: number, lineEnd: number
1070
1070
function cloneMarker ( xterm : Terminal , marker : IXtermMarker , offset : number = 0 ) : IXtermMarker | undefined {
1071
1071
const cursorY = xterm . buffer . active . baseY + xterm . buffer . active . cursorY ;
1072
1072
const cursorYOffset = marker . line - cursorY + offset ;
1073
- return xterm . registerMarker ( ( cursorY + cursorYOffset ) < 0 ? 0 : cursorYOffset ) ;
1073
+ return xterm . registerMarker ( ( cursorY + cursorYOffset ) < 0 ? - cursorY : cursorYOffset ) ;
1074
1074
}
0 commit comments