This is super annoying when it happens and I suspect it was one of my other programs like Thonny or arduino ide causing trouble when compling code to a Raspberry pi device, and somethings screws up.
The only thing that fixed this in the end was a complete shutdown and start up.
Restart does not seems to clear all the underlaying windows buffers.
I will report back here if it happens again, and I only had VS running at the time.
When this happened, it would do it when I was trying to copy code from another VS window to this Window. When I copied code inside this window, it just refused.
If I copied and pasted in the other VS window, it worked with no issues, making the whole excercise even harder to figure out who is the culprit.