fixed crash on long back press

The below change fixes the crash on long press on backspace key.
You should add one to the span end in most cases (otherwise you can wind up with extra spaces in the text field after several deletes under some circumstances). So you should probably check to see if the spanEnd is equal to the length, and add one to it if it is not.