@@ -22,7 +22,6 @@ import { DataTable } from './data-table'
2222import type { PdfDocumentSource } from './pdf-viewer'
2323import { PreviewPanel , resolvePreviewType } from './preview-panel'
2424
25- // Token rules shared by both themes — override the major categories; base handles the rest
2625const SIM_DARK_RULES : import ( 'monaco-editor' ) . editor . ITokenThemeRule [ ] = [
2726 { token : 'comment' , foreground : '606060' , fontStyle : 'italic' } ,
2827 { token : 'string' , foreground : '3ab872' } ,
@@ -855,19 +854,13 @@ function TextEditor({
855854
856855 if ( isStreamInteractionLocked || monacoValue === lastSyncedContentRef . current ) {
857856 if ( isStreamInteractionLocked ) {
858- // Measure BEFORE setValue — scrollHeight hasn't grown yet, so the
859- // "at bottom" check is accurate. Re-engage auto-scroll if at bottom;
860- // never disengage here (user scroll events do that via Effect 2).
861857 const scrollTop = editor . getScrollTop ( )
862858 const scrollHeight = editor . getScrollHeight ( )
863859 const { height } = editor . getLayoutInfo ( )
864860 if ( scrollHeight - scrollTop - height < 80 ) {
865861 textareaStuckRef . current = true
866862 }
867863 }
868- // Preserve the user's scroll position when they've scrolled away from the
869- // bottom. Suppress the onDidScrollChange listener so programmatic scroll
870- // changes (setValue / restoreViewState) don't falsely disengage auto-scroll.
871864 const viewState =
872865 isStreamInteractionLocked && ! textareaStuckRef . current ? editor . saveViewState ( ) : null
873866 suppressScrollListenerRef . current = true
@@ -885,10 +878,6 @@ function TextEditor({
885878 return
886879 }
887880
888- // Effect 1 re-engages auto-scroll (sets true) immediately before each setValue,
889- // measuring scroll position while scrollHeight is still accurate. This listener
890- // only needs to disengage when the user physically scrolls away from the bottom.
891- // Suppressed during programmatic setValue/restoreViewState in Effect 1.
892881 const disposable = editor . onDidScrollChange ( ( ) => {
893882 if ( suppressScrollListenerRef . current ) return
894883 const scrollTop = editor . getScrollTop ( )
0 commit comments