Improve delete-surrounding-text implementation.

Correctly handle deleting past the beginning.