Fix/improve ansi-term mode, make inserting newlines nicer when between braces.
Delete unused code.