kaio / ibus-table

The tables engines for IBus
GNU Lesser General Public License v2.1
32 stars 7 forks source link

Don’t add self._single_wildcard_char and self._multi_wildcard_char to se... #42

Closed mike-fabian closed 10 years ago

mike-fabian commented 10 years ago

...lf._valid_input_chars and self._pinyin_valid_input_chars

This is because the wildcard characters can be changed with the setup tool at runtime. If they are added to the string of valid input characters, the old wildcards would need to be removed from that string if the wildcards are changed. But the wildcard character may have been in that list already before it was added as a wildcard character. In that case, only one instance of the old wildcard character should be removed from the string of valid input characters if the wildcard character is changed. Replacing the wildcard characters in the string of valid input characters when they change seems more confusing that not adding them to that string in the first place.

Therefore, I do not add the wildcard characters to the string of valid input characters anymore, but that means that when checking whether a character is a valid input character

if c in self._valid_input_chars:

is not enough anymore, now one needs

if c in self._valid_input_chars + self._single_wildcard_char + self._multi_wildcard_char:

That seems less confusing than adding the wildcard characters to self._valid_input_chars and replacing them there when they change.