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

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

bug#38013: [PATCH] Rectangular region selection with mouse


From: Mattias Engdegård
Subject: bug#38013: [PATCH] Rectangular region selection with mouse
Date: Thu, 7 Nov 2019 18:48:21 +0100

5 nov. 2019 kl. 10.35 skrev martin rudalics <rudalics@gmx.at>:

> Any code based on mouse dragging should be written in such way that
> the corresponding click event can be easily handed over to a separate
> command.  That's what the drag- prefix is for.

All right, I re-wrote the patch to allow for independent use for X-mouse-N, 
but...

> > but doesn't it force the pop-up menu to be used with
> > click-release-select-click-release instead of the quicker
> > click-select-release?
> 
> Yes and I think that the former is the correct and expected behavior.
> I don't use the buffer menu but if I did I were much more annoyed by
> the fact that when I abandon the selection by clicking somewhere else
> I get an active region which I then have to click away in a further
> step.

I don't think so; being able to select from a menu with a single dragging 
movement is not only more ergonomic, it's the expected behaviour of pop-up 
menus. mouse.el even contains a comment to that effect:

 ;; By binding these to down-going events, we let the user use the up-going
 ;; event to make the selection, saving a click.

You can try for yourself: with the patch applied, bind M-mouse-1 to a menu:

 (global-set-key [M-mouse-1] 'mouse-buffer-menu)

Now a single meta-click will open the menu, and meta-drag will mark a 
rectangle. This sort of multiplexing doesn't feel right, and affects both uses 
negatively.

For example, suppose you have marked a rectangle and change your mind. 
Intuitively, you will click somewhere to make the mark go away, using the same 
modifiers. But that doesn't work, because now you get a pop-up menu.

> IMHO the rule should be that non-dragging commands are always bound to
> clicks (including double and triple ones) and never to a down- event.

My patch now follows that rule, but it doesn't seem to solve any problem.

> And personally, I'd reserve C-drag-mouse for marking arbitrary
> non-contiguous text (like, for example, Firefox does) and use
> C-S-drag-mouse for marking rectangular regions.

Emacs's mouse bindings seem rather haphazard and organised mainly on the 
principle of first-come, enshrining a fair bit of historical baggage. For 
example, there are two different buffer menus (one for font and one for 
everything else). There is also the secondary selection, of which there seems 
to be much fewer actual users than people who just want to know how to disable 
it.

We could do worse than following some conventions that have become more or less 
universal, such as right-clicking (control-click on macOS) for a context menu.

That said, do you have any particular reason (precedence, ergonomics) for 
suggesting control-shift? I'd rather use meta and move secondary selection to 
shift-meta (say).

(As before, the attached patch uses meta but that is just a placeholder and 
should not be interpreted as the final word.)

Attachment: 0001-Mouse-rectangular-region-selection-bug-38013.patch
Description: Binary data



reply via email to

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