@@ -469,6 +469,7 @@ wrapInputState maxWidth attrs cursorAttrs (InputState before after) =
469469 (Just (top', midB), Just (midA, bottom')) -> case T.uncons midA of
470470 Nothing -> (top', midB, ' ', "", bottom')
471471 Just (c, rest) -> (top', midB, c, rest, bottom')
472+ wrappedTop = wrap top
472473 (midBeforeTop, midBefore') = fromMaybe ([], "") $ initLast $ wrap [midBefore]
473474 cursorAfterEOL = T.length midBefore' == maxWidth
474475 (midAfter', midAfterBottom) =
@@ -478,7 +479,7 @@ wrapInputState maxWidth attrs cursorAttrs (InputState before after) =
478479 x:xs -> (x, xs)
479480 cursor = V.char cursorAttrs cursorChar
480481 images = mconcat
481− [ vstring <$> wrap top
482+ [ vstring <$> wrappedTop
482483 , vstring <$> midBeforeTop
483484 , if cursorAfterEOL
484485 then
@@ -498,7 +499,7 @@ wrapInputState maxWidth attrs cursorAttrs (InputState before after) =
498499 , vstring <$> midAfterBottom
499500 , vstring <$> bottom
500501 ]
501− cursorY = length top + length midBeforeTop + if cursorAfterEOL then 1 else 0
502+ cursorY = length wrappedTop + length midBeforeTop + if cursorAfterEOL then 1 else 0
502503 in (images, cursorY)
503504 where
504505 before' = T.split (=='\n') before