From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#23478: 25.0.93; Mouse region selection asymmetry Date: Sun, 08 May 2016 17:44:49 +0200 Message-ID: <878tzky2oe.fsf@gmx.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1462722386 601 80.91.229.3 (8 May 2016 15:46:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 May 2016 15:46:26 +0000 (UTC) To: 23478@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 08 17:46:14 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1azQuI-0004OH-Nu for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 May 2016 17:46:11 +0200 Original-Received: from localhost ([::1]:37132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azQuH-0007uw-T0 for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 May 2016 11:46:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azQuF-0007rs-2Z for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azQuA-0005yQ-Pi for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:46:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azQuA-0005yM-Mo for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1azQuA-0002mx-BF for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 May 2016 15:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23478 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.146272230910644 (code B ref -1); Sun, 08 May 2016 15:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 May 2016 15:45:09 +0000 Original-Received: from localhost ([127.0.0.1]:43368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azQtI-0002lc-Ls for submit@debbugs.gnu.org; Sun, 08 May 2016 11:45:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1azQtG-0002kr-RT for submit@debbugs.gnu.org; Sun, 08 May 2016 11:45:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azQtA-0005pW-7F for submit@debbugs.gnu.org; Sun, 08 May 2016 11:45:01 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:52230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azQtA-0005pP-45 for submit@debbugs.gnu.org; Sun, 08 May 2016 11:45:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azQt7-0006RS-Nm for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:44:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azQt3-0005ns-EX for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:44:56 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:50426) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azQt3-0005nU-0x for bug-gnu-emacs@gnu.org; Sun, 08 May 2016 11:44:53 -0400 Original-Received: from rosalinde ([89.245.107.13]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MAyZg-1apYyz43sa-009xEz for ; Sun, 08 May 2016 17:44:50 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.93 (gnu/linux) X-Provags-ID: V03:K0:BYCv2RBdN2Y8htEFOwy+YWlLU9tBomWjO+Fc4uPxMO2/fWyUvFf eq5aixU/IeQX802Bzq+UVyf4u1Lr+vrM8euY1Vrd7TqWmzLO8b6zEDR6bZnvDcddPC1PDEM IMIPdAcTMuG7sCh0Ye+jx7/tG05D9Ei0CBJc4fe2kbGxXI+61IdPtzeNVmBgbwrEsy7vcSG QXTP57BA8TlYdSdtNb4DA== X-UI-Out-Filterresults: notjunk:1;V01:K0:w/71NvayzRg=:8uWrSXnWeMVcCuO5hmxK56 KB7l7avDjVBiKAaUj0YvN+TorW/yiUjvI9jyGaL8Yr2/uX9GdZhXbTH14rDKfTfv8NQcBAsrP ea18ijPZYG/nfsEYP7gAhqpJyHKPvfU/2xMLwlzLmAGcQLWusYlmN4l2uhAZeVVColBPHpMak GfDEgCfW0SwqFe7kZkDad5HNAALjX91EUcI949yfHeHGvLLisMLnwvxjZPX6kS/XVyjd//qbK GJHTRh9xZ2EPlBjstA5kNTSugN5EAduhQ5bi5pULURpZ8VQ1L6NsS2pVM+aItrkO/Fj9qVoe9 c3ehc507w3qS4oU8DJxt9b1wc3bRO+gjFAAvRkqZB1lDTDqQo8HLxSEUQ+xtn4RdA7WC9VaCa kavwBDaDEcatss6NRI3ezHqX/OQ0rm2uJvKejjqIiJ2dIB5IZODD1HiRA5q/LNmO1K6RJ/m9x 7xRb/dfrnYTK8URvOoXB1+/jfxC2wqGy04AQD4NXGQTkIrc73MT9CEALR2kFJu6A5KHRnWcjn 69ZojkhkBnFCRbyVoRxf1p2V7ciykoYpU6Cu2rW0sfgrEuIH86N43i+X9QuWDJMWO31NKHgo9 Oq/fb8LGBrpKF4wOEgZzC9MKcAyBHWrOEddbQfrd4kSOq6ObUDiRgXN0TGwWDxKI6e8Sb7HVg SD7tNOi9z+LD6l29qRbVC2IgVXVFu59pRC5kb5pu4RPxnoNYcG6OiLGTjJXXqoQZgDR2CkMjr Oe0lmnXe71qHAgSEL+E7mJ+I0StjvrJp8r8tE1OYrqVkcLwSurUrDb8wiN1FZkAbtbw9yy/H X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:117975 Archived-At: When you select a region by double-clicking with mouse-1 and the end of the region is below the last visible line of the window, Emacs recenters the display, making the entire selected region visible (unless it's larger than half the window's height). But when you select a region by double-clicking with mouse-1 and the beginning of the region is above the first visible line of the window, Emacs does not recenter the display, so the entire selected region is not visible. To reproduce: 0. emacs -Q 1. C-h t M-g M-g 42 RET (to open the English Emacs Tutorial and put point on line 42). 2. C-l C-l C-l (to make line 42 the last visible line in the window). 3. Double click with mouse-1 on the `(' before "hold" in line 42. => The display is recentered and the region between `(' on line 42 and `)' on line 43 is selected and highlighted. 4. C-a C-l C-l (to clear the selection highlighting and make line 43 the first visible line in the window). 5. Double click with mouse-1 on the `)' after "key" in line 43. => Line 43 is highlighted but remains the first visible line in the window and the part of the region on line 42 is not visible. This is not a program bug, since Emacs is behaving as intended, but it is a UX asymmetry that I think it would be preferable to eliminate. The patch below does that, but I'm not sure it's the best way to handle this, since I don't know whether calling `recenter' from Lisp may have undesirable side effects that the automatic recentering Emacs redisplay does when point moves out of the visible portion of the window does not have. diff --git a/lisp/mouse.el b/lisp/mouse.el index fa355ff..c3efefe 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -531,7 +531,10 @@ mouse-set-point (interactive "e\np") (mouse-minibuffer-check event) (if (and promote-to-region (> (event-click-count event) 1)) - (mouse-set-region event) + (progn + (mouse-set-region event) + (when (> (window-start) (region-beginning)) + (recenter))) ;; Use event-end in case called from mouse-drag-region. ;; If EVENT is a click, event-end and event-start give same value. (posn-set-point (event-end event)))) In GNU Emacs 25.0.93.5 (x86_64-suse-linux-gnu, GTK+ Version 3.14.15) of 2016-05-08 built on rosalinde Repository revision: cd27f7396b77086b6c02eff5b2648bfba439d264 Windowing system distributor 'The X.Org Foundation', version 11.0.11601000 System Description: openSUSE 13.2 (Harlequin) (x86_64) Configured using: 'configure --with-xwidgets 'CFLAGS=-Og -g3'' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XWIDGETS Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix