Work in StringElem offsets

This will go to Toolkit code (except for the cursor position) so we
need to work in StringElem indexes, not GUI offsets.
Pass the preferred parent when we undo a delete

This fixes a bug when undoing a delete where we would sometimes restore
the character into the wrong part of the StringElem. This needs a change
in the toolkit, but will still work (as well as before) with previous
toolkit versions. See bug 1888 at revision dd0ab28948e.