Skip to content
Snippets Groups Projects
  • Jean Chalard's avatar
    9fd9a68d
    Fix a bug on rotation with selection. · 9fd9a68d
    Jean Chalard authored
    The symptom : when text is selected and the device is rotated,
    sometimes the keyboard sets the word as being composed around
    the start of the selection. Upon the next rotation this ends up
    with the keyboard committing some text in place of the selection.
    
    The cause : another bug in the framework with rotation >.>
    The keyboard receives a call to startInput with a wrong cursor
    position, namely one that does not represent a selection. The
    keyboard sets a composition according to this wrong data. When
    the keyboard is rotated again, it commits the text, which takes
    the place of the selection.
    
    The solution : actually when restarting input the keyboard
    realizes that the cursor position is wrong. We cancel composition
    at that time.
    For robustness, this change also implements two other defensive
    changes : upon call to onUpdateSelection, we actually realize
    that the previous values were wrong, so we also fix it at that
    time, and in addition, when rotating, we finishComposingText()
    instead of commitText() which is less dangerous. Implementing
    this later change also allows us to let less internal variables
    from InputLogic escape to LatinIME, so it's also a good change
    for design.
    
    Bug: 14140799
    
    Change-Id: Ib10de18e53e376ac1bbc8487e13d969828483346
    9fd9a68d
    History
    Fix a bug on rotation with selection.
    Jean Chalard authored
    The symptom : when text is selected and the device is rotated,
    sometimes the keyboard sets the word as being composed around
    the start of the selection. Upon the next rotation this ends up
    with the keyboard committing some text in place of the selection.
    
    The cause : another bug in the framework with rotation >.>
    The keyboard receives a call to startInput with a wrong cursor
    position, namely one that does not represent a selection. The
    keyboard sets a composition according to this wrong data. When
    the keyboard is rotated again, it commits the text, which takes
    the place of the selection.
    
    The solution : actually when restarting input the keyboard
    realizes that the cursor position is wrong. We cancel composition
    at that time.
    For robustness, this change also implements two other defensive
    changes : upon call to onUpdateSelection, we actually realize
    that the previous values were wrong, so we also fix it at that
    time, and in addition, when rotating, we finishComposingText()
    instead of commitText() which is less dangerous. Implementing
    this later change also allows us to let less internal variables
    from InputLogic escape to LatinIME, so it's also a good change
    for design.
    
    Bug: 14140799
    
    Change-Id: Ib10de18e53e376ac1bbc8487e13d969828483346