From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Issue with rectangle mouse selection Date: Sat, 30 Nov 2019 12:08:47 +0100 Message-ID: <78251E2C-8618-4591-9C12-2A127295B606@acm.org> References: <20191128100030.u5v5fto3vudkadnn.ref@Ergus> <20191128100030.u5v5fto3vudkadnn@Ergus> <4726417A-97DA-492B-8A56-1B08BF016CD1@acm.org> <20191128171117.tgxqnqnjl4lttvwj@Ergus> <96AD0983-D0FA-42B9-9063-B347CDE720F1@acm.org> <20191129143956.6kjcnpzdj463e5d3@Ergus> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_B1672A3C-5748-4DCD-A25C-298B1564FB16" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="145116"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Emacs developers To: Ergus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 30 12:09:28 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ib0cy-000bch-ET for ged-emacs-devel@m.gmane.org; Sat, 30 Nov 2019 12:09:28 +0100 Original-Received: from localhost ([::1]:39576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib0cw-0005jw-Mg for ged-emacs-devel@m.gmane.org; Sat, 30 Nov 2019 06:09:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44917) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ib0cR-0005jn-Mt for emacs-devel@gnu.org; Sat, 30 Nov 2019 06:08:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ib0cQ-0001Ug-Kp for emacs-devel@gnu.org; Sat, 30 Nov 2019 06:08:55 -0500 Original-Received: from mail232c50.megamailservers.eu ([91.136.10.242]:55694 helo=mail37c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ib0cQ-0001Sa-3j for emacs-devel@gnu.org; Sat, 30 Nov 2019 06:08:54 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1575112130; bh=B36khNdNJ0ZHOadDc0lE8Lg/5iyADedBUxr6aQTdD14=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=reOSC8WeBxmnmYMFzB17bXSsjH8UDoaHWliyA3IkRK1sbtzpJRsFc6VeQCs3JhEdx +XxXBWBA39SC7c0xf+70IgP94gyL1bkarbcXdRQBl7esVcSDv0awtdFFRD3VrBP3e9 MlAXM7wDzcR0WqvTLQun5SnSkmClt15UeK6Lg1kQ= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-6f4fe655.032-75-73746f71.bbcust.telenor.se [85.230.79.111]) (authenticated bits=0) by mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id xAUB8lYY017230; Sat, 30 Nov 2019 11:08:49 +0000 In-Reply-To: <20191129143956.6kjcnpzdj463e5d3@Ergus> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0204.5DE24DC2.0008, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=eN1tc0h1 c=1 sm=1 tr=0 a=fHaj9vQUQVKQ4sUldAaXuQ==:117 a=fHaj9vQUQVKQ4sUldAaXuQ==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=M51BFTxLslgA:10 a=3oc9M9_CAAAA:8 a=i6LxMJplEArSVv7HohsA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 a=_T4VdBtYPXoCZ5y4ZusA:9 a=B2y7HmGcmWMA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.136.10.242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242912 Archived-At: --Apple-Mail=_B1672A3C-5748-4DCD-A25C-298B1564FB16 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 29 nov. 2019 kl. 15.39 skrev Ergus : > YES!!! this seems to work now. :) Perhaps the workaround should be mentioned in the docs for = xterm-mouse-mode? > So the only issue now is what I reported on yesterday about the = distance > between rectangle border (point) and pointer in white spaces (or empty > lines). But it seems to be related with display-line-numbers-mode. That's clearly wrong, thanks for spotting it. There were problems with = side-by-side windows as well. In addition, the mouse tracking was = sometimes one cell off. Please try the attached patch. I couldn't make up my mind whether to have the mouse track the cursor or = the rectangle corner. Tracking the cursor mirrors the behaviour of plain = (linear) text selection, but corner tracking works better up to the = right margin. You can set mouse--rectangle-track-cursor to select either behaviour; = I'm not sure if it should be a defcustom, or what the default should be. = Right now it's nil (tracks the corner). --Apple-Mail=_B1672A3C-5748-4DCD-A25C-298B1564FB16 Content-Disposition: attachment; filename=0001-Improved-mouse-rectangle-selection-robustness-bug-38.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Improved-mouse-rectangle-selection-robustness-bug-38.patch" Content-Transfer-Encoding: quoted-printable =46rom=20737a80aee81679b62e3b4505e7c670135a211bb4=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sat,=2030=20Nov=202019=2011:37:04=20+0100=0A= Subject:=20[PATCH]=20Improved=20mouse=20rectangle=20selection=20= robustness=20(bug#38013)=0A=0AMake=20the=20rectangular=20selection=20= work=20better=20with=0Adisplay-line-numbers-mode=20and=20side-by-side=20= windows.=0AAlso=20make=20the=20mouse=20track=20either=20the=20text=20= cursor=20or=20the=20rectangle=0Acorner=20in=20a=20consistent=20way.=0A=0A= *=20lisp/mouse.el=20(mouse--rectangle-track-cursor):=20Added=20constant.=0A= (mouse-drag-region-rectangle):=20Take=20the=20line-number=20width=20into=0A= account,=20and=20use=20window-relative=20columns.=20=20Track=20either=20= the=20cursor=20or=0Arectangle=20corner=20with=20more=20care.=0A---=0A=20= lisp/mouse.el=20|=2018=20+++++++++++++-----=0A=201=20file=20changed,=20= 13=20insertions(+),=205=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/mouse.el=20b/lisp/mouse.el=0Aindex=20f076e90bd9..4aaf876252=20= 100644=0A---=20a/lisp/mouse.el=0A+++=20b/lisp/mouse.el=0A@@=20-1964,6=20= +1964,10=20@@=20secondary-selection-from-region=0A=20=20=20=20=20= (move-overlay=20mouse-secondary-overlay=20(region-beginning)=20= (region-end))))=0A=20=0A=20=0C=0A+(defconst=20= mouse--rectangle-track-cursor=20nil=0A+=20=20"Whether=20the=20mouse=20= tracks=20the=20cursor=20when=20selecting=20a=20rectangle.=0A+If=20nil,=20= the=20mouse=20tracks=20the=20rectangle=20corner=20instead.")=0A+=0A=20= (defun=20mouse-drag-region-rectangle=20(start-event)=0A=20=20=20"Set=20= the=20region=20to=20the=20rectangle=20that=20the=20mouse=20is=20dragged=20= over.=0A=20This=20must=20be=20bound=20to=20a=20button-down=20mouse=20= event."=0A@@=20-1980,6=20+1984,7=20@@=20mouse-drag-region-rectangle=0A=20= =20=20=20=20=20=20=20=20=20(bottom=20(if=20(window-minibuffer-p=20= start-window)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(nth=203=20bounds)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(1-=20(nth=203=20bounds))))=0A+=20=20=20=20=20=20=20=20=20= (extra-margin=20(round=20(line-number-display-width=20'columns)))=0A=20=20= =20=20=20=20=20=20=20=20(dragged=20nil)=0A=20=20=20=20=20=20=20=20=20=20= (old-track-mouse=20track-mouse)=0A=20=20=20=20=20=20=20=20=20=20= (old-mouse-fine-grained-tracking=20mouse-fine-grained-tracking)=0A@@=20= -1988,8=20+1993,9=20@@=20mouse-drag-region-rectangle=0A=20=20=20=20=20=20= =20=20=20=20(adjusted-col=20(lambda=20(col)=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(eq=20= (current-bidi-paragraph-direction)=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 'right-to-left)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(-=20(frame-text-cols)=20col=20-1)=0A-=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20col)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(-=20(window-width)=20col=20extra-margin=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(if=20mouse--rectangle-track-cursor=201=20-1))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (-=20col=20extra-margin))))=0A=20=20=20=20=20=20=20=20=20=20(map=20= (make-sparse-keymap)))=0A=20=20=20=20=20(define-key=20map=20= [switch-frame]=20#'ignore)=0A=20=20=20=20=20(define-key=20map=20= [select-window]=20#'ignore)=0A@@=20-2018,13=20+2024,15=20@@=20= mouse-drag-region-rectangle=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(hscroll=20(if=20(window-live-p=20window)=0A=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (window-hscroll=20window)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=200))=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(mouse-pos=20(mouse-position))=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(mouse-col=20(+=20(cadr=20mouse-pos)=20hscroll))=0A= -=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(mouse-row=20(cddr=20= mouse-pos))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(mouse-row=20= (cddr=20(mouse-position)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (mouse-col=20(+=20(car=20(posn-col-row=20posn))=20hscroll=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (if=20mouse--rectangle-track-cursor=200=201)))=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(set-col=20(lambda=20()=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(or=20= (eolp)=20(eq=20(following-char)=20?\t))=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (rectangle--col-pos=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(funcall=20adjusted-col=20= mouse-col)=20'point)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(unless=20mouse--rectangle-track-cursor=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(forward-char))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (rectangle--reset-point-crutches)))))=0A=20=20=20=20=20=20=20=20=20=20=20= (if=20(and=20(eq=20window=20start-window)=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20mouse-row=0A--=20=0A2.21.0=20(Apple=20= Git-122.2)=0A=0A= --Apple-Mail=_B1672A3C-5748-4DCD-A25C-298B1564FB16--