Almost decouple layouting and drawing in vty frontend.

Also fix jumping modeline.