To check from and to positions that are wrapped, need to do in 2 steps
check from subFromPosition ( = fromPosition) -> subToPosition (= doc end)
and then
check from subFromPosition (= 0) -> subToPosition (= toPosition)