fix word selection on multiple lines. Closes T305
fix 58ec67bfa about removing shadow variables