When doing word selection use the previous selection anchor if the new one is out of bounds (user scrolled out of view or similar).
A more proper (but still not really proper) fix than b85bbaa8c8807ab3619cddc35b634c2bb43e09fb reverted by 213afc0e0ceebc88c90552cd91fa8680e54603ed
I have a branch refactoring the word selection stuff a bit, but it's a bit more invasive. This is the minimal change I could get to fix it.