@@ -1159,7 +1159,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
11591159 if ( selection ) {
11601160 cell . updateEditState ( CellEditState . Editing , 'setOptions' ) ;
11611161 cell . focusMode = CellFocusMode . Editor ;
1162- await this . revealLineInCenterIfOutsideViewportAsync ( cell , selection . startLineNumber ) ;
1162+ await this . revealRangeInCenterIfOutsideViewportAsync ( cell , new Range ( selection . startLineNumber , selection . startColumn , selection . endLineNumber || selection . startLineNumber , selection . endColumn || selection . startColumn ) ) ;
11631163 } else if ( options ?. cellRevealType === CellRevealType . NearTopIfOutsideViewport ) {
11641164 await this . _list . revealCellAsync ( cell , CellRevealType . NearTopIfOutsideViewport ) ;
11651165 } else {
@@ -1170,16 +1170,13 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
11701170 if ( editor ) {
11711171 if ( cellOptions . options ?. selection ) {
11721172 const { selection } = cellOptions . options ;
1173- editor . setSelection ( {
1174- ...selection ,
1175- endLineNumber : selection . endLineNumber || selection . startLineNumber ,
1176- endColumn : selection . endColumn || selection . startColumn
1177- } ) ;
1173+ const editorSelection = new Range ( selection . startLineNumber , selection . startColumn , selection . endLineNumber || selection . startLineNumber , selection . endColumn || selection . startColumn ) ;
1174+ editor . setSelection ( editorSelection ) ;
11781175 editor . revealPositionInCenterIfOutsideViewport ( {
11791176 lineNumber : selection . startLineNumber ,
11801177 column : selection . startColumn
11811178 } ) ;
1182- await this . revealLineInCenterIfOutsideViewportAsync ( cell , selection . startLineNumber ) ;
1179+ await this . revealRangeInCenterIfOutsideViewportAsync ( cell , editorSelection ) ;
11831180 }
11841181 if ( ! cellOptions . options ?. preserveFocus ) {
11851182 editor . focus ( ) ;
0 commit comments