previousLinePosition and nextLinePosition are dependent on legacy editing positions but they shouldn't. We should rewrite these two functions to support non-legacy positions.