I just tried selecting two characters, and after the first number then yes, the caret jumps to the end because you keep updating on every change. It's a rather cumbersome way to do the formatting. Do you really need to format it in place? There's probably a bunch of use cases that are going to make this awkward to get right.