Commit a252ab4
committed
fix(files): fix two scroll logic bugs introduced in previous streaming scroll fix
The prior fix introduced a regression for the "user was at bottom" case and
a false-disengagement bug from programmatic scroll events.
Bug 1 — Effect ordering: all three effects fire on the same render when
isStreamInteractionLocked flips true. Effect 2 called isAtBottom() AFTER
Effect 1 had already called model.setValue(), which grew scrollHeight. The
old "at bottom" scroll position was now 200px short of the new bottom, so
isAtBottom() returned false, textareaStuckRef was set false, and Effect 3
never called revealLine. Users at the bottom stopped following the stream.
Fix: measure isAtBottom() in Effect 1 BEFORE setValue, while scrollHeight
is still accurate. Set textareaStuckRef = true only (never false here).
Effect 2 no longer initializes the ref — only the listener disengages it.
Bug 2 — onDidScrollChange fires during model.setValue: Monaco fires
onDidScrollChange when scroll dimensions change, including when setValue
grows the document. This caused the listener to disengage auto-scroll on
every content update even with no user interaction.
Fix: add suppressScrollListenerRef, set true before setValue/restoreViewState
and false after. The listener exits early when suppressed, so only genuine
user scroll events (wheel, trackpad, keyboard, scrollbar) can disengage.
Both refs moved to the component's ref block for conventional placement.1 parent 8cec4a3 commit a252ab4
1 file changed
Lines changed: 27 additions & 13 deletions
Lines changed: 27 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| 802 | + | |
| 803 | + | |
802 | 804 | | |
803 | 805 | | |
804 | 806 | | |
| |||
852 | 854 | | |
853 | 855 | | |
854 | 856 | | |
855 | | - | |
856 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
857 | 871 | | |
858 | 872 | | |
| 873 | + | |
859 | 874 | | |
860 | 875 | | |
| 876 | + | |
861 | 877 | | |
862 | 878 | | |
863 | 879 | | |
864 | 880 | | |
865 | | - | |
866 | 881 | | |
867 | 882 | | |
868 | 883 | | |
869 | 884 | | |
870 | 885 | | |
871 | 886 | | |
872 | 887 | | |
873 | | - | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
874 | 894 | | |
875 | 895 | | |
876 | 896 | | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
886 | 900 | | |
887 | 901 | | |
888 | 902 | | |
| |||
0 commit comments