From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#41156: margins interfere with xterm-mouse-mode Date: Mon, 14 Jun 2021 22:29:36 -0700 Message-ID: <0726d33d5a1f5463cd7d3d60217104be@finder.org> References: <2E809CFD-2C79-4529-BB68-4510A0F7C4D9@gmail.com> <87o8ca3qyp.fsf_-_@gnus.org> <87czso1un5.fsf@gnus.org> <831r947gfy.fsf@gnu.org> Reply-To: Jared Finder Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31474"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.3.16 Cc: rudalics@gmx.at, Lars Ingebrigtsen , 41156@debbugs.gnu.org, neil.okamoto@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 15 07:30:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lt1eN-00081U-H3 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Jun 2021 07:30:11 +0200 Original-Received: from localhost ([::1]:35426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lt1eM-0005aC-4O for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Jun 2021 01:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lt1eE-0005a3-My for bug-gnu-emacs@gnu.org; Tue, 15 Jun 2021 01:30:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lt1eE-0005md-Eb for bug-gnu-emacs@gnu.org; Tue, 15 Jun 2021 01:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lt1eE-0005ot-BH for bug-gnu-emacs@gnu.org; Tue, 15 Jun 2021 01:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jared Finder Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Jun 2021 05:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41156 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 41156-submit@debbugs.gnu.org id=B41156.162373498122315 (code B ref 41156); Tue, 15 Jun 2021 05:30:02 +0000 Original-Received: (at 41156) by debbugs.gnu.org; 15 Jun 2021 05:29:41 +0000 Original-Received: from localhost ([127.0.0.1]:48246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lt1ds-0005nq-Iu for submit@debbugs.gnu.org; Tue, 15 Jun 2021 01:29:40 -0400 Original-Received: from greenhill.hpalace.com ([192.155.80.58]:47874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lt1dp-0005nh-S4 for 41156@debbugs.gnu.org; Tue, 15 Jun 2021 01:29:39 -0400 Original-Received: from mail.finder.org (greenhill.hpalace.com [IPv6:2600:3c01::f03c:91ff:fe73:2daa]) by greenhill.hpalace.com (Postfix) with ESMTPSA id CE4B8CB; Tue, 15 Jun 2021 05:29:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=finder.org; s=2018; t=1623734976; bh=WgVy50kA9fnBjinSBP4FaAs7bFwLpcLzzBGLrL/ekmw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XGb+giNv6EpBHeIeAbppkVdq5eAdDz4mWbfiHjqJudbL/7Z1qDbrD5L/A/qJm4inO XZjSdyIXLR6aKsidxqgNka9K2bUk2u8hwyFh/i7at8bdz8TgjaIqIBXAzGSVS75vhB zT5htNn4MTcYL+lEZLvz53ZmZpdUnPQs/uOdsFaz5s1R4JW8ykYzidOlFOFJe2K4SQ cL5EtVzRnLzld4riDcvRw9Rqs6GmJph7uZ5HWRRdArHJ3+hbUv0A07ECQSpPA0yE/o M44+AZ+DAyctomAvZzAXrS0tbAoa2qmlcrPymzae16HcNUUPu8tiX+XZPJJZAhuhDM pNq3z5USGwAxg== In-Reply-To: X-Sender: jared@finder.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208524 Archived-At: On 2021-06-14 8:51 pm, Jared Finder wrote: > On 2021-06-14 5:56 am, Eli Zaretskii wrote: >>> From: Lars Ingebrigtsen >>> Date: Mon, 14 Jun 2021 14:46:22 +0200 >>> Cc: 41156@debbugs.gnu.org, Neil Okamoto >>> >>> martin rudalics 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