Better gnome-terminal support. And fix for restoring cursor position when quitting the interactive shell.