Several fixes for per-word cursor movement