Merge pull request #20750 from RudyLu/keyboard/Bug1015541

Bug 1015541 - choosing a word suggestion after moving the caret changes the wrong text
r=janjongboom
(cherry picked from commit 73b9c780c54ec1c6fcf47c2ce467672d3c5aaded)