emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1be3bd0: Fix region extension when scroll bar is on


From: Eli Zaretskii
Subject: [Emacs-diffs] master 1be3bd0: Fix region extension when scroll bar is on the right
Date: Thu, 05 Mar 2015 16:58:05 +0000

branch: master
commit 1be3bd0ad86644e091ba655a6b8d592c395701ad
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix region extension when scroll bar is on the right
    
     src/keyboard.c (make_lispy_position): When the click is on the
     right-side vertical scroll bar, pass the rightmost X coordinate to
     buffer_posn_from_coords, so that the returned text position
     reflects the closest point to the click.  Fixes region extension
     when mouse moves outside the Emacs frame that has scroll bars on
     the right.
---
 src/ChangeLog  |    9 +++++++++
 src/keyboard.c |   15 +++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index cfef5c4..ae827cb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2015-03-05  Eli Zaretskii  <address@hidden>
+
+       * keyboard.c (make_lispy_position): When the click is on the
+       right-side vertical scroll bar, pass the rightmost X coordinate to
+       buffer_posn_from_coords, so that the returned text position
+       reflects the closest point to the click.  Fixes region extension
+       when mouse moves outside the Emacs frame that has scroll bars on
+       the right.
+
 2015-03-04  Martin Rudalics  <address@hidden>
 
        * frame.c (x_set_font): Try to keep frame height and width
diff --git a/src/keyboard.c b/src/keyboard.c
index e1c5691..bf65df1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5360,9 +5360,9 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
          dy = yret = wy;
        }
 
-      /* For clicks in the text area, fringes, or margins, call
-        buffer_posn_from_coords to extract TEXTPOS, the buffer
-        position nearest to the click.  */
+      /* For clicks in the text area, fringes, margins, or vertical
+        scroll bar, call buffer_posn_from_coords to extract TEXTPOS,
+        the buffer position nearest to the click.  */
       if (!textpos)
        {
          Lisp_Object string2, object2 = Qnil;
@@ -5370,11 +5370,14 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
          int dx2, dy2;
          int width2, height2;
          /* The pixel X coordinate passed to buffer_posn_from_coords
-            is the X coordinate relative to the text area for
-            text-area and right-margin clicks, zero otherwise.  */
+            is the X coordinate relative to the text area for clicks
+            in text-area, right-margin/fringe and right-side vertical
+            scroll bar, zero otherwise.  */
          int x2
            = (part == ON_TEXT) ? xret
-           : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN)
+           : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN
+              || (part == ON_VERTICAL_SCROLL_BAR
+                  && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)))
            ? (XINT (x) - window_box_left (w, TEXT_AREA))
            : 0;
          int y2 = wy;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]