REPL history: ignore blank lines except in the history entry itself.

Blank lines before, during, or after the metadata block are ignored.
REPL history: rstrip all history entries instead of b5fc8c84bc.

My main issue with the replace '\n' approach is that some people
have crazy systems where '\r\n' or even '\r' is the standard line
ending. Even if we don't produce anything but '\n', people might
open history files in their editors which could save the files
with different line endings. Instead, this just strips trailing
whitespace from history entires, ensuring that trailing newlines
cannot be produced. Of course, I also modified the history parser
so that it ignores newlines, so even if these were produced, it
wouldn't be an issue anymore.