@@ -248,6 +248,8 @@ export class InlineChatController implements IEditorContribution {
248
248
if ( ! needsMargin ) {
249
249
this . _zone . value . setWidgetMargins ( widgetPosition , 0 ) ;
250
250
}
251
+ }
252
+ if ( this . _activeSession ) {
251
253
this . _zone . value . updateBackgroundColor ( widgetPosition , this . _activeSession . wholeRange . value ) ;
252
254
}
253
255
this . _zone . value . show ( widgetPosition ) ;
@@ -371,10 +373,12 @@ export class InlineChatController implements IEditorContribution {
371
373
this . _messages . fire ( msg ) ;
372
374
} ) ) ;
373
375
376
+ const altVersionNow = this . _editor . getModel ( ) ?. getAlternativeVersionId ( ) ;
377
+
374
378
this . _sessionStore . add ( this . _editor . onDidChangeModelContent ( e => {
375
379
376
380
if ( ! this . _ignoreModelContentChanged && this . _strategy ?. hasFocus ( ) ) {
377
- this . _ctxUserDidEdit . set ( true ) ;
381
+ this . _ctxUserDidEdit . set ( altVersionNow !== this . _editor . getModel ( ) ?. getAlternativeVersionId ( ) ) ;
378
382
}
379
383
380
384
if ( this . _ignoreModelContentChanged || this . _strategy ?. hasFocus ( ) ) {
@@ -465,7 +469,12 @@ export class InlineChatController implements IEditorContribution {
465
469
const { lastExchange } = this . _activeSession ;
466
470
this . _activeSession . addInput ( lastExchange . prompt . retry ( ) ) ;
467
471
if ( lastExchange . response instanceof EditResponse ) {
468
- await this . _strategy . undoChanges ( lastExchange . response ) ;
472
+ try {
473
+ this . _ignoreModelContentChanged = true ;
474
+ await this . _strategy . undoChanges ( lastExchange . response ) ;
475
+ } finally {
476
+ this . _ignoreModelContentChanged = false ;
477
+ }
469
478
}
470
479
return State . MAKE_REQUEST ;
471
480
}
0 commit comments