REPL tab don't double " (Fix #7318)

Also removes a small amount of code-duplication.
Works when completing noncompleteable strings.
Don't tab-close " when content is a dir.
Don't let "C:\\<tab>" kill the REPL.
Quotes in C locale (always available) work best.
should fix #7983
Merge pull request #8122 from tkelman/backports

Backport fixes for #7318, #8076, #8094, and #7983 to release-0.3