Commit 8cec4a3
committed
fix(files): preserve scroll position during Mothership streaming edits
Two fixes to the Monaco auto-scroll logic:
1. At streaming start, initialize textareaStuckRef from the editor's actual
scroll position (isAtBottom check) instead of unconditionally setting true.
Previously every streaming session jumped the viewport to the last line on
the very first content update, even when the user was reading mid-file.
2. Replace the wheel-only DOM listener with editor.onDidScrollChange(), the
proper Monaco API. This covers trackpad, scrollbar drag, and keyboard scroll
— not just mouse wheel. As a bonus, scrolling back to the bottom during
streaming now re-engages follow mode (matching iTerm2/xterm.js behavior).
3. Save and restore view state around model.setValue() during streaming when
the user has scrolled away from the bottom. This prevents Monaco from
resetting the viewport on each content replacement. When the user is at
the bottom, view state is not saved so Effect 3 can scroll to the new bottom.1 parent 14f77b3 commit 8cec4a3
1 file changed
Lines changed: 18 additions & 10 deletions
Lines changed: 18 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
855 | 859 | | |
| 860 | + | |
856 | 861 | | |
857 | 862 | | |
858 | 863 | | |
| |||
865 | 870 | | |
866 | 871 | | |
867 | 872 | | |
868 | | - | |
869 | | - | |
870 | | - | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
871 | 879 | | |
872 | | - | |
873 | | - | |
| 880 | + | |
| 881 | + | |
874 | 882 | | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
879 | 887 | | |
880 | 888 | | |
881 | | - | |
| 889 | + | |
882 | 890 | | |
883 | 891 | | |
884 | 892 | | |
| |||
0 commit comments