int () { int composedStartIndex = 0; int composedEndIndex = 0; if (composedText != null) { composedStartIndex = composedTextRange.getStartOffset(); composedEndIndex = composedTextRange.getEndOffset(); } int caretIndex = getCaretModel().getOffset(); if (caretIndex < composedStartIndex) { return caretIndex; } if (caretIndex < composedEndIndex) { return composedStartIndex; } return caretIndex - (composedEndIndex - composedStartIndex); }