Reorganize session saving code and constants.
Better text input: do not lock cursor at the end of the string, instead have a "start" parameter like the OS (and any good text input) does.