@@ -469,6 +469,7 @@ wrapInputState maxWidth attrs cursorAttrs (InputState before after) =
469 (Just (top', midB), Just (midA, bottom')) -> case T.uncons midA of
469 (Just (top', midB), Just (midA, bottom')) -> case T.uncons midA of
470 Nothing -> (top', midB, ' ', "", bottom')
470 Nothing -> (top', midB, ' ', "", bottom')
471 Just (c, rest) -> (top', midB, c, rest, bottom')
471 Just (c, rest) -> (top', midB, c, rest, bottom')
472+ wrappedTop = wrap top
472 (midBeforeTop, midBefore') = fromMaybe ([], "") $ initLast $ wrap [midBefore]
473 (midBeforeTop, midBefore') = fromMaybe ([], "") $ initLast $ wrap [midBefore]
473 cursorAfterEOL = T.length midBefore' == maxWidth
474 cursorAfterEOL = T.length midBefore' == maxWidth
474 (midAfter', midAfterBottom) =
475 (midAfter', midAfterBottom) =
@@ -478,7 +479,7 @@ wrapInputState maxWidth attrs cursorAttrs (InputState before after) =
478 x:xs -> (x, xs)
479 x:xs -> (x, xs)
479 cursor = V.char cursorAttrs cursorChar
480 cursor = V.char cursorAttrs cursorChar
480 images = mconcat
481 images = mconcat
481− [ vstring <$> wrap top
482+ [ vstring <$> wrappedTop
482 , vstring <$> midBeforeTop
483 , vstring <$> midBeforeTop
483 , if cursorAfterEOL
484 , if cursorAfterEOL
@@ -498,7 +499,7 @@ wrapInputState maxWidth attrs cursorAttrs (InputState before after) =
498 , vstring <$> midAfterBottom
499 , vstring <$> midAfterBottom
499 , vstring <$> bottom
500 , vstring <$> bottom
501− cursorY = length top + length midBeforeTop + if cursorAfterEOL then 1 else 0
502+ cursorY = length wrappedTop + length midBeforeTop + if cursorAfterEOL then 1 else 0
502 in (images, cursorY)
503 in (images, cursorY)
504 before' = T.split (=='\n') before
505 before' = T.split (=='\n') before