Revert changes to cursor adjustment during replaceRange

Issue #1415