BTW in View Command Handlers I made a function to get the visible first and last line but it is a bit complex, and maybe there is an easier way to do it now that CM has new APIs. Also the function `_getLinesInView` isn't great for exporting since the parameters aren't great. I used it to calculate the visible lines several time in the past to deal with inline editors, but now that it is called once, it should just receive an editor and do some of the calculations already done in `_scrollLine`.

Saying that probably using `codemirror.getScrollInfo()` and `codemirror.lineAtHeight()` can make this a lot easier.