terminal: fix restoring of screen flags
terminal: fix TERM_FLAG_* comment

7BIT mode is enabled by default. Fix the comment to state this correctly.
terminal/subterm: skip setting parent's cursor

We draw our own cursor in subterm now, so there's no reason to update the
cursor-position of the parent terminal on each frame. The parent's cursor
is hidden, anyway.
terminal/screen: save state in separate object

Terminal state can be saved/restored by applications. To simplify our
internal handling, put all affected state into a separate object.
Especially with alternate screen buffers, this will simplify our code
significantly.
terminal/screen: add support for alternate screen buffers

Hook up SM/RM 47/1047-1049 and enable alternate screen buffers for term
applications.

(David: rebased on top of -git, renamed helpers and added docs)