Replace word in a single edit operation.

This allows the replacement to be cancelled with a single UNDO command.