lineMoveVisRelDown n | n < 0 = lineMoveVisRelUp $ negate n
                     | otherwise = do
    wid <- width <$> use lastActiveWindowA
    col <- curCol
    let jumps = col `div` wid
        next = n - jumps
    if next <= 0
        then leftN (n * wid)
        else do leftN (jumps * wid)
                void $ gotoLnFrom $ -1
                moveToEol
                lineMoveVisRelDown $ next - 1

-- | Implements the same logic that emacs' `mark-word` does.
-- Checks the mark point and moves it forth (or backward) for one word.
lineMoveVisRelDown n | n < 0 = lineMoveVisRelUp $ negate n
                     | otherwise = do
    wid <- width <$> use lastActiveWindowA
    col <- curCol
    let jumps = col `div` wid
        next = n - jumps
    if next <= 0
        then leftN (n * wid)
        else do leftN (jumps * wid)
                void $ gotoLnFrom $ -1
                moveToEol
                lineMoveVisRelDown $ next - 1

-- | Implements the same logic that emacs' `mark-word` does.
-- Checks the mark point and moves it forth (or backward) for one word.
lineMoveVisRelDown n | n < 0 = lineMoveVisRelUp $ negate n
                     | otherwise = do
    wid <- width <$> use lastActiveWindowA
    col <- curCol
    let jumps = col `div` wid
        next = n - jumps
    if next <= 0
        then leftN (n * wid)
        else do leftN (jumps * wid)
                void $ gotoLnFrom $ -1
                moveToEol
                lineMoveVisRelDown $ next - 1

-- | Implements the same logic that emacs' `mark-word` does.
-- Checks the mark point and moves it forth (or backward) for one word.