improved the variable input box cursor position issue

We have made an update to the way variables are inserted. Previously there were issues that upon variable insertion between words the cursor would end up at the end of the text box. 

Also when wanting to remove variables it would cause the cursor to skip to the end. 

Both of these issues have been fixed