unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rudalics@gmx.at, Lars Ingebrigtsen <larsi@gnus.org>,
	41156@debbugs.gnu.org, neil.okamoto@gmail.com
Subject: bug#41156: margins interfere with xterm-mouse-mode
Date: Mon, 14 Jun 2021 22:29:36 -0700	[thread overview]
Message-ID: <0726d33d5a1f5463cd7d3d60217104be@finder.org> (raw)
In-Reply-To: <d4d438c1fe1c8ce79413693ec3c30fa9@finder.org>

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





  reply	other threads:[~2021-06-15  5:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-06-15  7:50               ` martin rudalics
2021-06-15 11:19               ` Eli Zaretskii
2021-06-15 13:54               ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0726d33d5a1f5463cd7d3d60217104be@finder.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=41156@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jared@finder.org \
    --cc=larsi@gnus.org \
    --cc=neil.okamoto@gmail.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).