Reuse word snapshot to avoid invalid ranges

Close #563.
Merge pull request #629 from dungpa/fix-highlight-exception

Reuse word snapshot to avoid invalid ranges