Mobile/IME: Difference between revisions

Jump to navigation Jump to search
413 bytes added ,  9 February 2012
Line 32: Line 32:
A composing text is a range of text that you are currently working on. While it is in the composition state, it can be freely changed, these changes are considered as a batch operation, and are submitted as one update at the end of the composition, so the whole text modification is stored as one action in the edit history.
A composing text is a range of text that you are currently working on. While it is in the composition state, it can be freely changed, these changes are considered as a batch operation, and are submitted as one update at the end of the composition, so the whole text modification is stored as one action in the edit history.


GeckoInputConnection tracks the composing state using mComposing flag. When it receives a text modification request from Android it sets this flag and sends IME_COMPOSITION_BEGIN event to Gecko. While in that state the mComposingText variable contains the current composing text, and mCompositionStart points to a start index of the composition within the text body. mCompositionSelStart/mCompositionSelLen track the text selection during the composition, as Gecko selection is not supposed to change while in the composing state.
The actual composition state on Android side is handled by the BaseInputConnection class, with the composing range stored as a corresponding span in the mEditable member. GeckoInputConnection tracks the composing state using the mComposing flag. When it receives a text modification request from Android it sets this flag and sends IME_COMPOSITION_BEGIN event to Gecko. While in that state the composing text is sent to Gecko from sendTextToGecko() method. The composing may be ended either explicitly when finishComposingText() method is called by the system, or when the changes have to be committed for some reason. IME_COMPOSITION_END event is sent to Gecko to finish the composition.
 
As most of the external IME events handling is done by the BaseInputConnection class, Gecko composition state is a bit artificial, and sometimes may not exactly correspond to the state in BaseInputConnection class. There are areas for improvements here.


= Bugs =
= Bugs =
200

edits

Navigation menu