diff options
author | Glenn Morris <rgm@gnu.org> | 2014-07-08 19:04:12 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-07-08 19:04:12 -0700 |
commit | 5613a6f6d52bca0018c5777aba67a99f51016a35 (patch) | |
tree | c070100c79442ae2f9876f82af4eeebadc39249c /src/window.c | |
parent | 27e81f9f4e368176a3b17ceeadd2e0aa5dd9d1ed (diff) | |
parent | d8899d09b992d733dc1cc6ec93b11cb75ce84f5d (diff) | |
download | emacs-5613a6f6d52bca0018c5777aba67a99f51016a35.tar.gz |
Merge from emacs-24; up to 2014-06-19T14:03:45Z!monnier@iro.umontreal.ca
Diffstat (limited to 'src/window.c')
-rw-r--r-- | src/window.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c index 8a608433ed7..6afe7454149 100644 --- a/src/window.c +++ b/src/window.c @@ -5161,6 +5161,32 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); + /* If PT is in the screen line at the last fully visible line, + move_it_to will stop at X = 0 in that line, because the + required Y coordinate is reached there. See if we can get to + PT without descending lower in Y, and if we can, it means we + reached PT before the scroll margin. */ + if (charpos != PT) + { + struct it it2; + void *it_data; + + it2 = it; + it_data = bidi_shelve_cache (); + move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); + if (IT_CHARPOS (it) == PT && it.current_y == it2.current_y) + { + charpos = IT_CHARPOS (it); + bytepos = IT_BYTEPOS (it); + bidi_unshelve_cache (it_data, 1); + } + else + { + it = it2; + bidi_unshelve_cache (it_data, 0); + } + } + /* See if point is on a partially visible line at the end. */ if (it.what == IT_EOB) partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; |