Cursor not updated after setSelection()
I have an IME that makes use of calling the current InputConnection's setSelection(). When using it in this editor, it seems that the cursor is not being updated after calls to setSelection(). Touch-and-hold to select a word does update the cursor correctly.
For example, if I touch-and-held a word to select it, then went to another location and did these actions from the IME:
indexStart = somewhere not at the word I touched indexEnd = indexStart + 1 setSelection(indexStart, indexEnd) set shift to ON send the END key
The correct result should have been having text selected from indexStart to the end of the next end-of-line. However, instead, the selection would incorrectly start from the location of the touched word (from before) to end-of-line.
I have tried in other editors and it worked as expected.
So could you please kindly check if this is in fact an issue in this editor? (I'm using the editor version used in the latest official release AndroidIDE v2.7.1-beta). Thank you.
setSelection() fails when:
- editor is not editable (according to your description, the edtor is editable)
- the input connection is currently invalid
- editor is configured to disallow any suggestions (not enabled in AndroidIDE)
If all setSelection calls fail, this may be an app/ime issue.