Clear history search buffers upon ^C/^D

Closes #6370.

Also, minor code format fixes.
REPL search history: add ^U binding (clears buffer)