Skip to content
Snippets Groups Projects
  • Jean Chalard's avatar
    358e1327
    Fix a bug where autotext would occasionally not work · 358e1327
    Jean Chalard authored
    Autotext correction would check whether the first suggestion
    so far was the same as what Autotext would return, and if it
    was indeed the same, would not send its result as
    autocorrect. However, the first suggestion is not guaranteed
    to have a high enough score to trigger autocorrection, and
    there would be cases where a word in autotext would not get
    autocorrected because the word came out of bigram
    suggestions. These occurrences would be extremely rare, as
    they would require concomitant insert between autotext for
    one char and bigram suggestion. It is, in fact, probably
    limited to the capitalization of "I".
    
    This did not happen in gingerbread because gingerbread would
    not register 1-letter words as valid bigrams.
    
    This fix works by just always sending the result of autotext
    regardless of whether it is already the first suggestion or
    not. This is okay because duplicates are removed afterwards
    anyway - and this processing is absolutely necessary because
    the autotext'd word may actually be somewhere else in the
    suggestion, so it made really no sense checking for only the
    first one.
    
    Please note that there is also a race condition that can
    result in "i" not being converted to "I": at the moment,
    Latin IME relies on having the suggestions evaluated
    at the time autocorrection is performed, but when typing
    very, very fast, those messages may have been canceled.
    This is not limited to the autocorrection of "i", but
    affects all autocorrections. It requires a nearly
    inhumane typing speed to trigger, but hitting "i" and
    space in turn as fast as one can it's possible to
    reproduce occasionally.
    
    Bug: 5135113
    Change-Id: I530ea6212487300001a2c0fc5b25a5c7716bdf63
    358e1327
    History
    Fix a bug where autotext would occasionally not work
    Jean Chalard authored
    Autotext correction would check whether the first suggestion
    so far was the same as what Autotext would return, and if it
    was indeed the same, would not send its result as
    autocorrect. However, the first suggestion is not guaranteed
    to have a high enough score to trigger autocorrection, and
    there would be cases where a word in autotext would not get
    autocorrected because the word came out of bigram
    suggestions. These occurrences would be extremely rare, as
    they would require concomitant insert between autotext for
    one char and bigram suggestion. It is, in fact, probably
    limited to the capitalization of "I".
    
    This did not happen in gingerbread because gingerbread would
    not register 1-letter words as valid bigrams.
    
    This fix works by just always sending the result of autotext
    regardless of whether it is already the first suggestion or
    not. This is okay because duplicates are removed afterwards
    anyway - and this processing is absolutely necessary because
    the autotext'd word may actually be somewhere else in the
    suggestion, so it made really no sense checking for only the
    first one.
    
    Please note that there is also a race condition that can
    result in "i" not being converted to "I": at the moment,
    Latin IME relies on having the suggestions evaluated
    at the time autocorrection is performed, but when typing
    very, very fast, those messages may have been canceled.
    This is not limited to the autocorrection of "i", but
    affects all autocorrections. It requires a nearly
    inhumane typing speed to trigger, but hitting "i" and
    space in turn as fast as one can it's possible to
    reproduce occasionally.
    
    Bug: 5135113
    Change-Id: I530ea6212487300001a2c0fc5b25a5c7716bdf63