Bug #1019753, modify selected word highlight algorithm