bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23478: 25.0.93; Mouse region selection asymmetry


From: Stephen Berman
Subject: bug#23478: 25.0.93; Mouse region selection asymmetry
Date: Mon, 04 Jul 2016 20:26:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

On Mon, 04 Jul 2016 18:56:03 +0200 Stephen Berman <stephen.berman@gmx.net> 
wrote:

> diff --git a/lisp/mouse.el b/lisp/mouse.el
> index 8d72753..39adc42 100644
> --- a/lisp/mouse.el
> +++ b/lisp/mouse.el
> @@ -548,7 +548,11 @@ mouse-set-point
>    (interactive "e\np")
>    (mouse-minibuffer-check event)
>    (if (and promote-to-region (> (event-click-count event) 1))
> -      (mouse-set-region event)
> +      (progn
> +        (mouse-set-region event)
> +        (when (> (window-start) (region-beginning))
> +       (exchange-point-and-mark)
> +       (sit-for 0)))
>      ;; Use event-end in case called from mouse-drag-region.
>      ;; If EVENT is a click, event-end and event-start give same value.
>      (posn-set-point (event-end event))))
>
> This makes the bevavior even more like the first situation (i.e., the
> mirror image of it).  So I like this solution even better.  What do you
> think?

That patch only mirrors the first situation when the region begins above
the window; the following always changes point when clicking at what
will be the end point of the region, so this fully mirrors the first
situation, and would be the most symmetrical behavior (unless I'm
overlooking something):

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 8d72753..608a52f 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -548,7 +548,11 @@ mouse-set-point
   (interactive "e\np")
   (mouse-minibuffer-check event)
   (if (and promote-to-region (> (event-click-count event) 1))
-      (mouse-set-region event)
+      (progn
+        (mouse-set-region event)
+        (when (> (posn-point (event-start event)) (region-beginning))
+         (exchange-point-and-mark)
+         (sit-for 0)))
     ;; Use event-end in case called from mouse-drag-region.
     ;; If EVENT is a click, event-end and event-start give same value.
     (posn-set-point (event-end event))))

Steve Berman





reply via email to

[Prev in Thread] Current Thread [Next in Thread]