From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 134ba45: Allow two mouse functions to work with Rectangle Mark mode Date: Sat, 20 Oct 2018 17:21:25 -0400 Message-ID: References: <20181017063829.3775.67018@vcs0.savannah.gnu.org> <20181017063831.03DCB2044D@vcs0.savannah.gnu.org> <810f1e04-1117-476d-9a7d-d57002609bf8@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1540070410 29826 195.159.176.226 (20 Oct 2018 21:20:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 20 Oct 2018 21:20:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Federico Tedin Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 20 23:20:06 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDyfF-0007bZ-Ec for ged-emacs-devel@m.gmane.org; Sat, 20 Oct 2018 23:20:05 +0200 Original-Received: from localhost ([::1]:56596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDyhL-00021w-QR for ged-emacs-devel@m.gmane.org; Sat, 20 Oct 2018 17:22:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDygf-00021d-5l for emacs-devel@gnu.org; Sat, 20 Oct 2018 17:21:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDyga-0004uK-7k for emacs-devel@gnu.org; Sat, 20 Oct 2018 17:21:33 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:35736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDyga-0004u7-39 for emacs-devel@gnu.org; Sat, 20 Oct 2018 17:21:28 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w9KLLQD8022956; Sat, 20 Oct 2018 17:21:26 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id F10286A3F3; Sat, 20 Oct 2018 17:21:25 -0400 (EDT) In-Reply-To: (Federico Tedin's message of "Sat, 20 Oct 2018 17:21:08 -0300") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6400=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6400> : inlines <6936> : streams <1801890> : uri <2734563> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:230533 Archived-At: > I thought you were actually referring to another problem. Consider the > following example, where a buffer contains the text (spaces added for > clarity): > > a > b b > c c c > d d d d > > ...and the user selects the following rectangular region: > > [a ] > [b b ] > [c c c ] > [d d d d] > > In this case, the first overlay will actually only contain "a", so > subtracting (current-column) in its end and start will yield 1. This > makes sense, as evaluating (car (region-bounds)) yields (1 . 2). Ah, right, that's yet another problem, indeed. > Something I also realized is that the variables 'region-width' and > 'region-height' are 1) rectangular region-specific Sorry for not mentioning it earlier. > and 2) are only used when checking if the region is being dragged into > itself (setq drag-but-neglibible ...). I don't understand enough of the "dragged into itself" test to know what should be done here. I think part of the issue is that for rectangular regions, the "insert-for-yank" will actually not just insert, so we can't just test "is insertion-point inside region-bounds?" (which could be easily implemented in a generic way). But at the same time, why should we disallow dragging the rectangle to a place that overlaps its original location? > Maybe their definition could be moved to > that specific part of the code (and only define them when the region > is rectangular). If that can be done, that sounds good. > I believe the only parts of the code that is rectangle-specific are: > > 1) Checking if the drag is negligible > 2) Inserting the text in the new position > 3) Re-activating the region after a successful or failed drag insert-for-yank takes care of (2), doesn't it? Stefan