@@ -297,7 +297,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
297297 return this . _cursors . getAll ( ) ;
298298 }
299299
300- public setStates ( source : string , reason : CursorChangeReason , states : PartialCursorState [ ] | null ) : void {
300+ public setStates ( source : string , reason : CursorChangeReason , states : PartialCursorState [ ] | null ) : boolean {
301301 if ( states !== null && states . length > Cursor . MAX_CURSOR_COUNT ) {
302302 states = states . slice ( 0 , Cursor . MAX_CURSOR_COUNT ) ;
303303 this . _onDidReachMaxCursorCount . fire ( undefined ) ;
@@ -311,7 +311,7 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
311311
312312 this . _validateAutoClosedActions ( ) ;
313313
314- this . _emitStateChangedIfNecessary ( source , reason , oldState ) ;
314+ return this . _emitStateChangedIfNecessary ( source , reason , oldState ) ;
315315 }
316316
317317 public setColumnSelectData ( columnSelectData : IColumnSelectData ) : void {
@@ -411,7 +411,9 @@ export class Cursor extends viewEvents.ViewEventEmitter implements ICursors {
411411 } else {
412412 if ( this . _hasFocus && e . resultingSelection && e . resultingSelection . length > 0 ) {
413413 const cursorState = CursorState . fromModelSelections ( e . resultingSelection ) ;
414- this . setStates ( 'modelChange' , e . isUndoing ? CursorChangeReason . Undo : e . isRedoing ? CursorChangeReason . Redo : CursorChangeReason . RecoverFromMarkers , cursorState ) ;
414+ if ( this . setStates ( 'modelChange' , e . isUndoing ? CursorChangeReason . Undo : e . isRedoing ? CursorChangeReason . Redo : CursorChangeReason . RecoverFromMarkers , cursorState ) ) {
415+ this . _revealRange ( 'modelChange' , RevealTarget . Primary , viewEvents . VerticalRevealType . Simple , true , editorCommon . ScrollType . Smooth ) ;
416+ }
415417 } else {
416418 const selectionsFromMarkers = this . _cursors . readSelectionFromMarkers ( ) ;
417419 this . setStates ( 'modelChange' , CursorChangeReason . RecoverFromMarkers , CursorState . fromModelSelections ( selectionsFromMarkers ) ) ;
0 commit comments