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.
Merge pull request #8047 from lucasb-eyer/master

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