[Top][All Lists]

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

Re: New Context Menu and mouse-1

From: Stefan Monnier
Subject: Re: New Context Menu and mouse-1
Date: Fri, 27 Aug 2021 18:01:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> diff --git a/lisp/mouse.el b/lisp/mouse.el
> index 7d3ed9a0e4..933ad5181e 100644
> --- a/lisp/mouse.el
> +++ b/lisp/mouse.el
> @@ -1578,9 +1578,7 @@ mouse-drag-track
>         map)
>       t (lambda ()
>           (setq track-mouse old-track-mouse)
> -         (setq auto-hscroll-mode auto-hscroll-mode-saved)
> -         (deactivate-mark)
> -         (pop-mark)))))
> +         (setq auto-hscroll-mode auto-hscroll-mode-saved)))))
>  (defun mouse--drag-set-mark-and-point (start click click-count)
>    (let* ((range (mouse-start-end start click click-count))
> Then everything works fine: the aforementioned case
> and the normal using mouse-1 to select a region.

Note that this changes conceptually what `mouse-drag-track` does.
Instead of only giving visual feedback during a drag, it actually does
select the region (whereas in the current code, the region selection is
actually performed by the binding of `drag-mouse-1` to `mouse-set-region`).

So the above will lead to `mouse-set-region` being called when the
region has already been set (at least in terminals that provide
`mouse-movement` events).

I'm not sure if it can introduce problems, but it would deserve
a comment about the fact that the region selection is performed
"redundantly" here and in `mouse-set-region` and why it's done this way.

>From what I remember about the last time I worked in this code, it's
a somewhat messy area.

BTW, maybe another way to look at the problem is to say that
invoking the context-menu should not exit the transient map (but this
may come with its own set of problems, of course).

Related to this, I wonder if `down-mouse-1` .. move .. `down-mouse-3`,
`up-mouse-3` ... `up-mouse-1` would and/or should generate
a `drag-mouse-1` event.


reply via email to

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