Fix for #12279  (caret jumps when formatting in RTA).

Change-Id: I09bd04cd0d687be636a7b4d718bccf271bdb9dd9