Moving Cursor position in a TextField/Area.

Hello, im trying to replace 1 character with 2 new ones and this results in the cursor being inbetween the 2 new characters.

stringToEdit = stringToEdit.Replace("A","BB");

57906-a.png

57907-bb.png

Is there a workaround or solution so i can type without placing the cursor in the front manually?

hi use this inputfeild.MoveTextEnd(false);

This might not be elegant, but it might be something to try experimenting with a little bit.

TextEditor txt = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
txt.cursorIndex += 1;

I can’t guarantee perfection from this, but if nothing else, hopefully it’s at least a good lead to start from.