Subject: bug#18590: 24.3.93; Scrolling changes/forgets selection

From: Eli Zaretskii <[email-masked]>
Date: Tue, 30 Sep 2014 17:28:39 +0300

> From: [email-masked] (N. Jackson)
> Date: Tue, 30 Sep 2014 10:07:02 -0300
> 
> 1. emacs -Q
> 
> 2. Open a file "longer" than the window such as the Emacs README file. E.g. C-x f R E A D M E
> 
> 3. C-x h    ; Select all the text in the window.
> 
> 4. Scroll the window with the scroll bar or the mouse.
> 
> Expected behaviour:
> 
> The text that is selected/highlighted remains selected/highlighted.
> 
> Observed behaviour:
> 
> The selection changes as the window is scrolled up and down.
> 
> ===
> 
> Note 1: This also happens when the selected text was selected by holding
> down the shift key and using the arrow keys to extend the selection, or
> if the text is selected with the mouse.
> 
> Note 2: When a smaller region is selected, the selection is sometimes
> lost entirely after it is scrolled off the top or bottom of the window
> and then scrolled back in to view.
> 
> Note 3: I see the same (or similar) behaviour in Emacs 24.3.1 (which is
> the oldest version I have on this system), but that does not make it
> correct. Is this bizarre behaviour intended? It seems that if the user
> makes a selection, Emacs should not change their selection without good
> reason; is there a good reason?

Yes, there's a good reason: a selection in Emacs is always between
point and the mark, and when scrolling causes it to go off the
displayed portion of the buffer, Emacs moves point to bring it back
into view, which changes the selected portion of the text.