Created by: ijt
Closes #4382. It's not a perfect solution, but it is likely to help in many cases.
Before:
After:
Test plan: unit test, local manual testing