diff options
| author | Eli Zaretskii | 2015-03-05 18:56:43 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-03-05 18:56:43 +0200 |
| commit | 1be3bd0ad86644e091ba655a6b8d592c395701ad (patch) | |
| tree | 3775aa0a0c45279fba1157f1b3b8e2fdf09542bd /src | |
| parent | 61e06b6cb23a719ad77ab3924beb3a0c21e9c2e9 (diff) | |
| download | emacs-1be3bd0ad86644e091ba655a6b8d592c395701ad.tar.gz emacs-1be3bd0ad86644e091ba655a6b8d592c395701ad.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/keyboard.c | 15 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cfef5c46d1a..ae827cb4416 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2015-03-05 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * keyboard.c (make_lispy_position): When the click is on the | ||
| 4 | right-side vertical scroll bar, pass the rightmost X coordinate to | ||
| 5 | buffer_posn_from_coords, so that the returned text position | ||
| 6 | reflects the closest point to the click. Fixes region extension | ||
| 7 | when mouse moves outside the Emacs frame that has scroll bars on | ||
| 8 | the right. | ||
| 9 | |||
| 1 | 2015-03-04 Martin Rudalics <rudalics@gmx.at> | 10 | 2015-03-04 Martin Rudalics <rudalics@gmx.at> |
| 2 | 11 | ||
| 3 | * frame.c (x_set_font): Try to keep frame height and width | 12 | * frame.c (x_set_font): Try to keep frame height and width |
diff --git a/src/keyboard.c b/src/keyboard.c index e1c5691324d..bf65df1584c 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, | |||
| 5360 | dy = yret = wy; | 5360 | dy = yret = wy; |
| 5361 | } | 5361 | } |
| 5362 | 5362 | ||
| 5363 | /* For clicks in the text area, fringes, or margins, call | 5363 | /* For clicks in the text area, fringes, margins, or vertical |
| 5364 | buffer_posn_from_coords to extract TEXTPOS, the buffer | 5364 | scroll bar, call buffer_posn_from_coords to extract TEXTPOS, |
| 5365 | position nearest to the click. */ | 5365 | the buffer position nearest to the click. */ |
| 5366 | if (!textpos) | 5366 | if (!textpos) |
| 5367 | { | 5367 | { |
| 5368 | Lisp_Object string2, object2 = Qnil; | 5368 | Lisp_Object string2, object2 = Qnil; |
| @@ -5370,11 +5370,14 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, | |||
| 5370 | int dx2, dy2; | 5370 | int dx2, dy2; |
| 5371 | int width2, height2; | 5371 | int width2, height2; |
| 5372 | /* The pixel X coordinate passed to buffer_posn_from_coords | 5372 | /* The pixel X coordinate passed to buffer_posn_from_coords |
| 5373 | is the X coordinate relative to the text area for | 5373 | is the X coordinate relative to the text area for clicks |
| 5374 | text-area and right-margin clicks, zero otherwise. */ | 5374 | in text-area, right-margin/fringe and right-side vertical |
| 5375 | scroll bar, zero otherwise. */ | ||
| 5375 | int x2 | 5376 | int x2 |
| 5376 | = (part == ON_TEXT) ? xret | 5377 | = (part == ON_TEXT) ? xret |
| 5377 | : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN) | 5378 | : (part == ON_RIGHT_FRINGE || part == ON_RIGHT_MARGIN |
| 5379 | || (part == ON_VERTICAL_SCROLL_BAR | ||
| 5380 | && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) | ||
| 5378 | ? (XINT (x) - window_box_left (w, TEXT_AREA)) | 5381 | ? (XINT (x) - window_box_left (w, TEXT_AREA)) |
| 5379 | : 0; | 5382 | : 0; |
| 5380 | int y2 = wy; | 5383 | int y2 = wy; |