My implementation of proper "application mode" for cursor keys.

This will conflict with https://github.com/jackpal/Android-Terminal-Emulator/pull/266
Add XTerm alt buffer support ("\E[?47h"/"\E[?47l").

Alt buf is used by many fullscreen apps to preserve original contents
of the console. This implementation is pretty basic, byt enough to run
Midnight Commander with proper switching between shell and panels.
Hack-add additional altbug command codes to make less work.

1049 probably should probably clear altbuf after all, but so far, less
itself overwrites entire altbug content itself.
f key hash map
Use XTerm codes for Home/End keys.

TODO: introduce xterm term time, set codes conditionally.