@@ -130,9 +130,10 @@ export class WalkThroughPart extends BaseEditor {
130130 broken : ! scrollTarget ,
131131 from : this . input instanceof WalkThroughInput ? this . input . getTelemetryFrom ( ) : undefined
132132 } ) ;
133- if ( scrollTarget ) {
134- const targetTop = scrollTarget . getBoundingClientRect ( ) . top ;
135- const containerTop = this . content . getBoundingClientRect ( ) . top ;
133+ const innerContent = this . content . firstElementChild ;
134+ if ( scrollTarget && innerContent ) {
135+ const targetTop = scrollTarget . getBoundingClientRect ( ) . top - 20 ;
136+ const containerTop = innerContent . getBoundingClientRect ( ) . top ;
136137 this . scrollbar . updateState ( { scrollTop : targetTop - containerTop } ) ;
137138 }
138139 } else {
@@ -303,6 +304,23 @@ export class WalkThroughPart extends BaseEditor {
303304 } ;
304305 updateHeight ( true ) ;
305306 this . contentDisposables . push ( editor . onDidChangeModelContent ( ( ) => updateHeight ( false ) ) ) ;
307+ this . contentDisposables . push ( editor . onDidChangeCursorPosition ( e => {
308+ const innerContent = this . content . firstElementChild ;
309+ if ( innerContent ) {
310+ const targetTop = div . getBoundingClientRect ( ) . top ;
311+ const containerTop = innerContent . getBoundingClientRect ( ) . top ;
312+ const lineHeight = editor . getConfiguration ( ) . lineHeight ;
313+ const lineTop = ( targetTop + ( e . position . lineNumber - 1 ) * lineHeight ) - containerTop ;
314+ const lineBottom = lineTop + lineHeight ;
315+ const scrollTop = this . scrollbar . getScrollTop ( ) ;
316+ const height = this . scrollbar . getHeight ( ) ;
317+ if ( scrollTop > lineTop ) {
318+ this . scrollbar . updateState ( { scrollTop : lineTop } ) ;
319+ } else if ( scrollTop < lineBottom - height ) {
320+ this . scrollbar . updateState ( { scrollTop : lineBottom - height } ) ;
321+ }
322+ }
323+ } ) ) ;
306324
307325 this . contentDisposables . push ( this . themeService . onDidColorThemeChange ( theme => editor . updateOptions ( { theme : theme . id } ) ) ) ;
308326
0 commit comments