In fixing a pasting bug (mishandling of whitespace when input had
prompts) it became clear the pasting code hadn't been updated
when the new prefiltering machinery was added. Furthermore, the
pasting magics are only for the terminal, but the code was in the
This refactors and simplifies the pasting code, moving it to the
terminal shell only, and removing unnecessary methods from the
main class (using small utility functions instead).
The tests were simplified because the previous regexp supported some
odd edge cases that are not valid in the normal prefiltering code. We
want to have a single location and set of rules for input
prefiltering, so I changed some of the test cases to be consistent
with what prefilter allows.