The valid bounds for a selection are not updated until the contents of the edit box are updated on commit, so set the selection after committing rather than before.
* To be written.