unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41156: 26.3; 27.0.91; linum-mode interferes with xterm-mouse-mode
@ 2020-05-09 18:21 Neil Okamoto
  2020-05-11 17:14 ` bug#41156: Updated description Neil Okamoto
  0 siblings, 1 reply; 11+ messages in thread
From: Neil Okamoto @ 2020-05-09 18:21 UTC (permalink / raw)
  To: 41156


You cannot drag the vertical boundary between windows to the right, if the righthand window has linum-mode active. I’ve confirmed this on Emacs 26.3 and 27.0.91. I have not tried earlier builds.

Steps to reproduce:

$ emacs -nw -q
    M-x xterm-mouse-mode
    C-x b *scratch*
    C-x 3

    Use the mouse to drag the vertical divider right and left? Succeeds.

Now enable linum-mode:

    M-x linum-mode

    Use the mouse to drag the vertical divider left? Succeeds.
    Use the mouse to drag the vertical divider right?
    Fails with the message "<left-margin> <mouse-movement> is undefined"


Thank you-




^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: Updated description
  2020-05-09 18:21 bug#41156: 26.3; 27.0.91; linum-mode interferes with xterm-mouse-mode Neil Okamoto
@ 2020-05-11 17:14 ` Neil Okamoto
  2021-06-13 12:10   ` bug#41156: margins interfere with xterm-mouse-mode Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Neil Okamoto @ 2020-05-11 17:14 UTC (permalink / raw)
  To: 41156

After further testing, I wanted to clarify that this occurs even without linum-mode.  It occurs whenever there are window margins to either side of the vertical divider.

So, e.g. 

$ emacs -nw -q
    M-x xterm-mouse-mode
    C-x b *scratch*
    C-x 3

    Use the mouse to drag the vertical divider right and left? Succeeds.

Now set a right margin on the left window:

    (set-window-margins (selected-window) 0 2)

    Use the mouse to drag the vertical divider to the left?
    Fails with the message “<right-margin> <mouse-movement> is undefined”

    (set-window-margins (selected-window) 0 0)

    And mouse-movement is permitted again.

Similarly, setting a left margin on the right window:

    (set-window-margins (selected-window) 2 0)

    Use the mouse to drag the vertical divider to the right?
    Fails with the message “<left-margin> <mouse-movement> is undefined”

    (set-window-margins (selected-window) 0 0)

    And mouse-movement is permitted again.







^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2020-05-11 17:14 ` bug#41156: Updated description Neil Okamoto
@ 2021-06-13 12:10   ` Lars Ingebrigtsen
  2021-06-13 14:52     ` martin rudalics
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-13 12:10 UTC (permalink / raw)
  To: Neil Okamoto; +Cc: 41156

Neil Okamoto <neil.okamoto@gmail.com> writes:

> After further testing, I wanted to clarify that this occurs even
> without linum-mode.  It occurs whenever there are window margins to
> either side of the vertical divider.
>
> So, e.g. 
>
> $ emacs -nw -q
>     M-x xterm-mouse-mode
>     C-x b *scratch*
>     C-x 3
>
>     Use the mouse to drag the vertical divider right and left? Succeeds.
>
> Now set a right margin on the left window:
>
>     (set-window-margins (selected-window) 0 2)
>
>     Use the mouse to drag the vertical divider to the left?
>     Fails with the message “<right-margin> <mouse-movement> is undefined”

(I'm going through old bug reports that unfortunately got no response at
the time.)

Testing this in Emacs 28, I do not get any errors (but I can reproduce
the issue in Emacs 27.1.)  However -- it still doesn't work: When
dragging the divider to the left, nothing happens.  (Dragging to the
right works fine.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-13 12:10   ` bug#41156: margins interfere with xterm-mouse-mode Lars Ingebrigtsen
@ 2021-06-13 14:52     ` martin rudalics
  2021-06-14 12:46       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: martin rudalics @ 2021-06-13 14:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Neil Okamoto; +Cc: 41156

 > Testing this in Emacs 28, I do not get any errors (but I can reproduce
 > the issue in Emacs 27.1.)  However -- it still doesn't work: When
 > dragging the divider to the left, nothing happens.  (Dragging to the
 > right works fine.

Unless you do

(set-window-margins (selected-window) 2 0)

in the window at right.

 > )

martin





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-13 14:52     ` martin rudalics
@ 2021-06-14 12:46       ` Lars Ingebrigtsen
  2021-06-14 12:56         ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-14 12:46 UTC (permalink / raw)
  To: martin rudalics; +Cc: 41156, Neil Okamoto

martin rudalics <rudalics@gmx.at> writes:

> Unless you do
>
> (set-window-margins (selected-window) 2 0)
>
> in the window at right.

Right, so I guess xterm-mouse-mode needs to define a key binding in the
margin area for these mouse commands?

Hm...  Well, I took a quick peek at xt-mouse.el for the first time in my
life, and that doesn't seem to be how that mode works at all.  Is
anybody familiar enough with xt-mouse that it's obvious to them what's
going wrong in this case?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-14 12:46       ` Lars Ingebrigtsen
@ 2021-06-14 12:56         ` Eli Zaretskii
  2021-06-15  3:51           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2021-06-14 12:56 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Jared Finder; +Cc: 41156, neil.okamoto

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Mon, 14 Jun 2021 14:46:22 +0200
> Cc: 41156@debbugs.gnu.org, Neil Okamoto <neil.okamoto@gmail.com>
> 
> martin rudalics <rudalics@gmx.at> writes:
> 
> > Unless you do
> >
> > (set-window-margins (selected-window) 2 0)
> >
> > in the window at right.
> 
> Right, so I guess xterm-mouse-mode needs to define a key binding in the
> margin area for these mouse commands?
> 
> Hm...  Well, I took a quick peek at xt-mouse.el for the first time in my
> life, and that doesn't seem to be how that mode works at all.  Is
> anybody familiar enough with xt-mouse that it's obvious to them what's
> going wrong in this case?

Jared, can you help us out here, please?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-14 12:56         ` Eli Zaretskii
@ 2021-06-15  3:51           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-15  5:29             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-15  3:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rudalics, Lars Ingebrigtsen, 41156, neil.okamoto

On 2021-06-14 5:56 am, Eli Zaretskii wrote:
>> From: Lars Ingebrigtsen <larsi@gnus.org>
>> Date: Mon, 14 Jun 2021 14:46:22 +0200
>> Cc: 41156@debbugs.gnu.org, Neil Okamoto <neil.okamoto@gmail.com>
>> 
>> martin rudalics <rudalics@gmx.at> writes:
>> 
>> > Unless you do
>> >
>> > (set-window-margins (selected-window) 2 0)
>> >
>> > in the window at right.
>> 
>> Right, so I guess xterm-mouse-mode needs to define a key binding in 
>> the
>> margin area for these mouse commands?
>> 
>> Hm...  Well, I took a quick peek at xt-mouse.el for the first time in 
>> my
>> life, and that doesn't seem to be how that mode works at all.  Is
>> anybody familiar enough with xt-mouse that it's obvious to them what's
>> going wrong in this case?
> 
> Jared, can you help us out here, please?

xterm-mouse-mode is running fine, it is correctly generating 
mouse-motion events with proper X,Y coordinates.

The actual drag keybinding is handled in mouse-drag-line in mouse.el.  
The following patch mostly works for me, though I see issues when 
dragging to the left and the left buffer has a margin of width greater 
than 1.  I think there's some incorrect logic in how the temporarily 
bound move function is converting calculating positions:

@@ -494,9 +494,12 @@ mouse-drag-line
  	       (define-key map [header-line] map)
  	       (define-key map [vertical-line] map)
  	       ;; ... and some maybe even with a right- or bottom-divider
-	       ;; prefix.
+	       ;; prefix ...
  	       (define-key map [right-divider] map)
  	       (define-key map [bottom-divider] map)
+               ;; ... and the margins too.
+               (define-key map [left-margin] map)
+               (define-key map [right-margin] map)
  	       map)
  	     t (lambda () (setq track-mouse old-track-mouse)))))))

I'll investigate a bit more later.

   -- MJF





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-15  3:51           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-06-15  5:29             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-15  7:50               ` martin rudalics
                                 ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-06-15  5:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: rudalics, Lars Ingebrigtsen, 41156, neil.okamoto

On 2021-06-14 8:51 pm, Jared Finder wrote:
> On 2021-06-14 5:56 am, Eli Zaretskii wrote:
>>> From: Lars Ingebrigtsen <larsi@gnus.org>
>>> Date: Mon, 14 Jun 2021 14:46:22 +0200
>>> Cc: 41156@debbugs.gnu.org, Neil Okamoto <neil.okamoto@gmail.com>
>>> 
>>> martin rudalics <rudalics@gmx.at> writes:
>>> 
>>> > Unless you do
>>> >
>>> > (set-window-margins (selected-window) 2 0)
>>> >
>>> > in the window at right.
>>> 
>>> Right, so I guess xterm-mouse-mode needs to define a key binding in 
>>> the
>>> margin area for these mouse commands?
>>> 
>>> Hm...  Well, I took a quick peek at xt-mouse.el for the first time in 
>>> my
>>> life, and that doesn't seem to be how that mode works at all.  Is
>>> anybody familiar enough with xt-mouse that it's obvious to them 
>>> what's
>>> going wrong in this case?
>> 
>> Jared, can you help us out here, please?
> 
> xterm-mouse-mode is running fine, it is correctly generating
> mouse-motion events with proper X,Y coordinates.
> 
> The actual drag keybinding is handled in mouse-drag-line in mouse.el.
> The following patch mostly works for me, though I see issues when
> dragging to the left and the left buffer has a margin of width greater
> than 1.  I think there's some incorrect logic in how the temporarily
> bound move function is converting calculating positions:
> 

And I'm fairly certain this is the proper fix.  If a window is live, 
then the AREA-OR-POS made by posn-at-x-y should never be nil, I believe:

--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -415,7 +415,7 @@ mouse-drag-line
  		(when (window-live-p (setq posn-window (posn-window start)))
  		  ;; Add left edge of `posn-window' to `position'.
  		  (setq position (+ (window-pixel-left posn-window) position))
-		  (unless (nth 1 start)
+		  (unless (posn-area start)
  		    ;; Add width of objects on the left of the text area to
  		    ;; `position'.
  		    (when (eq (window-current-scroll-bars posn-window) 'left)
@@ -494,9 +494,11 @@ mouse-drag-line
  	       (define-key map [header-line] map)
  	       (define-key map [vertical-line] map)
  	       ;; ... and some maybe even with a right- or bottom-divider
-	       ;; prefix.
+	       ;; or left- or right-margin prefix ...
  	       (define-key map [right-divider] map)
  	       (define-key map [bottom-divider] map)
+	       (define-key map [left-margin] map)
+	       (define-key map [right-margin] map)
  	       map)
  	     t (lambda () (setq track-mouse old-track-mouse)))))))

   -- MJF





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-15  5:29             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-06-15  7:50               ` martin rudalics
  2021-06-15 11:19               ` Eli Zaretskii
  2021-06-15 13:54               ` Lars Ingebrigtsen
  2 siblings, 0 replies; 11+ messages in thread
From: martin rudalics @ 2021-06-15  7:50 UTC (permalink / raw)
  To: Jared Finder, Eli Zaretskii; +Cc: Lars Ingebrigtsen, 41156, neil.okamoto

 > And I'm fairly certain this is the proper fix.  If a window is live,
 > then the AREA-OR-POS made by posn-at-x-y should never be nil, I
 > believe:

Looks good to me.

Thanks, martin





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-15  5:29             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-15  7:50               ` martin rudalics
@ 2021-06-15 11:19               ` Eli Zaretskii
  2021-06-15 13:54               ` Lars Ingebrigtsen
  2 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2021-06-15 11:19 UTC (permalink / raw)
  To: Jared Finder; +Cc: larsi, 41156, neil.okamoto

> Date: Mon, 14 Jun 2021 22:29:36 -0700
> From: Jared Finder <jared@finder.org>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>, rudalics@gmx.at,
>  41156@debbugs.gnu.org, neil.okamoto@gmail.com
> 
> >> Jared, can you help us out here, please?
> > 
> > xterm-mouse-mode is running fine, it is correctly generating
> > mouse-motion events with proper X,Y coordinates.
> > 
> > The actual drag keybinding is handled in mouse-drag-line in mouse.el.
> > The following patch mostly works for me, though I see issues when
> > dragging to the left and the left buffer has a margin of width greater
> > than 1.  I think there's some incorrect logic in how the temporarily
> > bound move function is converting calculating positions:
> > 
> 
> And I'm fairly certain this is the proper fix.  If a window is live, 
> then the AREA-OR-POS made by posn-at-x-y should never be nil, I believe:

Thanks, Jared.

Lars, feel free to install, unless you have comments.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#41156: margins interfere with xterm-mouse-mode
  2021-06-15  5:29             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-06-15  7:50               ` martin rudalics
  2021-06-15 11:19               ` Eli Zaretskii
@ 2021-06-15 13:54               ` Lars Ingebrigtsen
  2 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-15 13:54 UTC (permalink / raw)
  To: Jared Finder; +Cc: 41156, neil.okamoto

Jared Finder <jared@finder.org> writes:

> And I'm fairly certain this is the proper fix.  If a window is live,
> then the AREA-OR-POS made by posn-at-x-y should never be nil, I
> believe:

Looks good to me, and it fixes the reported test case for me, so I've
now pushed it to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-06-15 13:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 18:21 bug#41156: 26.3; 27.0.91; linum-mode interferes with xterm-mouse-mode Neil Okamoto
2020-05-11 17:14 ` bug#41156: Updated description Neil Okamoto
2021-06-13 12:10   ` bug#41156: margins interfere with xterm-mouse-mode Lars Ingebrigtsen
2021-06-13 14:52     ` martin rudalics
2021-06-14 12:46       ` Lars Ingebrigtsen
2021-06-14 12:56         ` Eli Zaretskii
2021-06-15  3:51           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-15  5:29             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-15  7:50               ` martin rudalics
2021-06-15 11:19               ` Eli Zaretskii
2021-06-15 13:54               ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).