Caret appears to far ahead of text

I’ve noticed a problem with the input text field in some of my apps where the caret will slowly get further and further away from where it should be the more you type but if the text starts to wrap to a new line it will get reset. It starts to get pretty confusing because the caret looks like you already have a space after a word that you type but then if you actually type you’ll see that the caret is just off.

Has anyone else experienced this at all and even better does anyone know how to prevent this from happening?