Subject: Re: mwheel.el uses (point) instead of point-before-scroll

From: Chong Yidong <[email-masked]>
Date: Fri, 04 Dec 2009 21:46:36 -0500

> Just upgraded emacs to 23.1 and noted the following issue, related
> (apparently) to mwheel.el.
>
> Here is how to (hopefully) reproduce the problem.
>
> In an emacs window (under X):
>
> => set the point with mouse-1
> => select a region with mouse-3 some lines below
> => now scroll down with the mouse wheel so that the bottom of the
>    selected region scrolls `out' of the upper edge of the emacs window
>    (the highlighted region must disappear)
> => extend the region by mouse-3 again
> => paste the region with mouse-2 somewhere (e.g. in a clean buffer)
>
>     Result:
>     only the text between the *visible* top of the window and the end of
>     the region has been pasted. I.e. all works as if the beginning of
>     the selected region had moved the first line of the visible portion
>     of the buffer.
>
> This contrasts with the behavior in emacs-22.3, where extending the
> region while scrolling down with the wheel used to work as expected
> (by me): the contents of the region started from the point set with
> mouse-1 at the beginning.
>
> The (correct) behavior in 23.1 is obtained if scrolling is performed
> with the side bar, instead of the wheel (and also if the scroll with
> the wheel does not make the bottom of the region fly out of the upper
> window edge)

This change was made in response to a complaint by Glenn Morris, about
the behavior you desire:

http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg00409.html

  Double-click with left mouse to select the word "tree" from "This
  directory tree...". The word "tree" is highlighted with region face.

  Scroll down with mouse-wheel so that "tree" goes off the top of the
  screen.

  Scroll back up with mouse-wheel.

  Now the region has been extended to cover a lot more text. The further
  I scroll down initially, the more is highlighted.

I have no preference for either behavior, because I don't use the mouse
wheel much.  Either way, we should probably make the scrollbar and mouse
wheel behavior consistent, though.

Glenn, what do you think?