inserted, not replaced, when the size of selected region is 0

The inserted string should be inserted, not replaced, when the size of selected region is 0.