Fix stepping through history generating artifacts

Additional minor changes:
* Provide a way to specify the prompt by setting PS1 environment
  variable
* Add newline when exiting via <Ctrl+d> so shell prompt has a line of
  its own after exit
Add some documentation
Pull fixes from 'master' into pty_test