Fix scrolling first selected line into view
Created by: fkling
Fixes #38177 (closed)
Problem: When selecting multiple lines such that the first selected line is out of view, the file view jumps back to the first selected line after selecting the last line.
This is because we are only considering the first selected line when we determine the position to scroll to.
This commit changes the logic to take into account the top and bottom of the complete line range.
Note: I made these changes based on my understanding how/when selected lines change. Please let me know if there is anything I might have missed.
https://user-images.githubusercontent.com/179026/177191566-00440d39-fc02-4b1f-bfe3-bc0a1e0b690e.mp4
Test plan
- Go to a file with lots of lines.
- Select first line, scroll down to selected last line. The first line should be scrolled out of view before selecting the last line.
- File view does not jump back to the first selected line.
- Reloading the page scrolls the selecting line range into view (either centered or the top only depending on the number of lines selected and the available space).
App preview:
Check out the client app preview documentation to learn more.