@@ -150,7 +150,7 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
150
150
// non-italic/dim text in the cell closest non-whitespace cell before the cursor
151
151
if ( absoluteCursorY === commandStartY && buffer . cursorX > 1 ) {
152
152
// Ghost text in pwsh only appears to happen on the cursor line
153
- ghostTextIndex = this . _scanForGhostText ( buffer , line ) ;
153
+ ghostTextIndex = this . _scanForGhostText ( buffer , line , cursorIndex ) ;
154
154
}
155
155
156
156
// IDEA: Detect line continuation if it's not set
@@ -184,6 +184,8 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
184
184
} else {
185
185
break ;
186
186
}
187
+ } else {
188
+ break ;
187
189
}
188
190
}
189
191
@@ -203,7 +205,7 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
203
205
* Detect ghost text by looking for italic or dim text in or after the cursor and
204
206
* non-italic/dim text in the cell closest non-whitespace cell before the cursor.
205
207
*/
206
- private _scanForGhostText ( buffer : IBuffer , line : IBufferLine ) : number {
208
+ private _scanForGhostText ( buffer : IBuffer , line : IBufferLine , cursorIndex : number ) : number {
207
209
// Check last non-whitespace character has non-ghost text styles
208
210
let ghostTextIndex = - 1 ;
209
211
let proceedWithGhostTextCheck = false ;
@@ -230,7 +232,7 @@ export class PromptInputModel extends Disposable implements IPromptInputModel {
230
232
break ;
231
233
}
232
234
if ( this . _isCellStyledLikeGhostText ( cell ) ) {
233
- ghostTextIndex = this . _cursorIndex + potentialGhostIndexOffset ;
235
+ ghostTextIndex = cursorIndex + potentialGhostIndexOffset ;
234
236
break ;
235
237
}
236
238
potentialGhostIndexOffset += cell . getChars ( ) . length ;
0 commit comments