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

That bug annoyed me a lit. I hope I didn't miss anything, because it was easier than what I expected!

I also removed a chunk of duplicate code on my way.