This is a really good question. It looks like there is no simple solution to the fix, however, there are some simple “hacks” which could help. Have you seen this issue?
I will use the horrible hack suggested.
In this case it is especially wrong because my text is examples of a markup language (javadoc-like), so if someone will cut’n’paste it it will NOT work because of the zero-width-space and it will be very difficult to understand why!
As of today, this is still a problem, and the linked issue above dates back 3 years.
If someone points me at the source code, I’ll do the fix.
Edit: Yes I’m necrothreading here but this is the most recent relevant post I could find with a brief search. And, the linked issue is locked so I can’t comment there.