Ensure REPL handles control chars properly and persist history in memory