Well, I'm trying to create a rich text editor. I have several buttons for formatting editable text (bold, italics, URL, etc.).
I use a Google keyboard with all text correction options turned on ( Settings > Language & Input > Google Keyboard > Text Correction ).
I do the following:
In my EditText I am writing text.

I select it and apply bold interval with SPAN_EXCLUSIVE_EXCLUSIVE (33) as flags.


Then I move the cursor to the end.

Finally, I add text to the end of the text. Added text should not be highlighted. 
Ok, here's the problem. My bold range flags have changed ... Why ??
Here are some magazines:
D/ContentUtils: beforeTextChanged: start end span flags D/ContentUtils: beforeTextChanged: 0 7 ChangeWatcher 8388626 D/ContentUtils: beforeTextChanged: 0 7 ChangeWatcher 6553618 D/ContentUtils: beforeTextChanged: 0 7 TextKeyListener 18 D/ContentUtils: beforeTextChanged: 0 7 SpanController 18 D/ContentUtils: beforeTextChanged: 7 7 START 546 D/ContentUtils: beforeTextChanged: 7 7 END 34 D/ContentUtils: beforeTextChanged: 0 7 SpellCheckSpan 33 D/ContentUtils: beforeTextChanged: 0 7 CustomBoldSpan 33 D/ContentUtils: onTextChaghed D/ContentUtils: onTextChaghed: 0 8 ChangeWatcher 8392722 D/ContentUtils: onTextChaghed: 0 8 ChangeWatcher 6557714 D/ContentUtils: onTextChaghed: 0 8 TextKeyListener 4114 D/ContentUtils: onTextChaghed: 0 8 SpanController 4114 D/ContentUtils: onTextChaghed: 8 8 START 546 D/ContentUtils: onTextChaghed: 8 8 END 34 D/ContentUtils: onTextChaghed: 0 8 CustomBoldSpan 4129 D/ContentUtils: onTextChaghed: 0 8 UnderlineSpan 289 D/ContentUtils: onTextChaghed: 0 8 ComposingText 289 D/ContentUtils: afterTextChanged D/ContentUtils: afterTextChanged: 0 8 ChangeWatcher 8392722 D/ContentUtils: afterTextChanged: 0 8 ChangeWatcher 6557714 D/ContentUtils: afterTextChanged: 0 8 TextKeyListener 4114 D/ContentUtils: afterTextChanged: 0 8 SpanController 4114 D/ContentUtils: afterTextChanged: 8 8 START 546 D/ContentUtils: afterTextChanged: 8 8 END 34 D/ContentUtils: afterTextChanged: 0 8 CustomBoldSpan 4129 D/ContentUtils: afterTextChanged: 0 8 UnderlineSpan 289 D/ContentUtils: afterTextChanged: 0 8 ComposingText 289 D/ContentUtils: afterTextChanged: 0 8 SpellCheckSpan 33
When I use a different keyboard, everything is going well.
When I turned off the text correction settings, everything went fine. My whole range is a custom range and a subclass of the existing Android range.
It seems that the Google Keyboard is changing my intervals to its own (possibly due to the Show suggestions settings).
How can i avoid this?
Maybe I'm missing something about span flags?
android
Pierre
source share