|
From: | Jared Finder |
Subject: | bug#41156: margins interfere with xterm-mouse-mode |
Date: | Mon, 14 Jun 2021 22:29:36 -0700 |
User-agent: | Roundcube Webmail/1.3.16 |
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 themargin area for these mouse commands?Hm... Well, I took a quick peek at xt-mouse.el for the first time in mylife, and that doesn't seem to be how that mode works at all. Isanybody familiar enough with xt-mouse that it's obvious to them what'sgoing 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
[Prev in Thread] | Current Thread | [Next in Thread] |