Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do the retransliteration of the input_phrase currently only when the …
…cursor is at the end of the typed string The retransliteration of the input_phrase is done because of https://bugzilla.redhat.com/show_bug.cgi?id=1353672 because adding a comit key to the input might influence the transliteration. Examples: When using hi-itrans, “. ” translates to “। ” When using unicode.mim, typing `C-u1f607` shows `U+1F607` in the preedit, typing a space after that it must be retransliterated to `😇`. The way this is currently implemented works only if the cursor is at the end of the preedit when the character triggering the commit is typed. Therefore, it should be done only when self._typed_string_cursor == len(self._typed_string) is True. Maybe it makes sense to do such a retransliteration also when the cursor is somewhere in the middle of the preedit. Adding a space, Tab, or Return in the middle of the preedit has its own `elif` in the key event handling where it might be necessary to do something similar: elif (key.val in (IBus.KEY_space, IBus.KEY_Tab, IBus.KEY_Return, IBus.KEY_KP_Enter) and (self._typed_string_cursor < len(self._typed_string))): So maybe I should change the implementation in that `elif` and consider the key which triggered the commit in the retransliteration of input_phrase_left. I am not sure yet whether that would be useful. And I am not sure either whether anything special should be done when keys other than space, Tab, or Return trigger a commit while the cursor is not at the end of the preedit. So I might improve this a bit in future. But currently this commit only fixes the error that a retransliteration of the input_phrase was done by adding the key which triggered the commit to the end of the input_phrase even when the cursor was not at the end. I am not aware of any problems caused by this, it is quite likely that it does not cause any problems at all. Nevertheless it clearly looks wrong and it is better to make the intention clearer in the code.
- Loading branch information