[wrap] start support for word wrapping and fix a variety of glitches