Corrected wrapping of lines embedding ANSI.

@{layout/wrap} now properly wraps lines containing arbitrary ANSI escape
sequences, a surprisngly more laborious task than it would seem. Exception
handling has been marginally improved as well, but still remains lamentably
broken.