Subject: 25.0.50; Undo with active region adds extra text

From: Drew Adams <[email-masked]>
Date: Sun, 20 Sep 2015 00:34:06 -0700 (PDT)

The Subject line is not very clear.  Here is a recipe.  You decide
whether the behavior is correct or a bug.  FWIW, this behavior is at
least as old as Emacs 20 (with transient-mark-mode on).

emacs -Q

In buffer *scratch*, put point before "that" on the last line.
`M-c', to capitalize "That".
`C-SPC C-e', to select the text after "That", up to eol.
(The region does not contain the word "That".)

`C-_' to undo the last change within the region.
The word "that" is inserted, giving this:

;; then enter the text in Thatthat file=A1=AFs own buffer.

This seems disconcerting, at least.  (Same behavior for `M-u' etc.)

(I can see the explanation of why this happens coming as a reply.  As I
say, you can decide whether this behavior is OK as is.)

In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2015-09-05
Bzr revision: 2330ca33a97867f2ea1123bcf7bfe5cfcc030b36
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --host=3Di686-pc-mingw32 --enable-checking=3Dyes,glyphs'