This new method allow you to get the line offset of the current selection (returns -1 if nothing is selected.) This is useful if you want to pop up a control or menu above the currently selected text. Previously there was no accurate way to get this information. The logic is moved from the implementation of `scroll_to_selection` verbatim, and that method has been adjusted to avoid repetition.