diff options
| author | Kim F. Storm | 2005-02-21 22:34:34 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-02-21 22:34:34 +0000 |
| commit | aed328bfc31b7a1430efe0901f12f09b7e7db033 (patch) | |
| tree | aff0127ce0a285067fa0ecaa0bb2139229aa5975 | |
| parent | 81c85b536e3981a118a2d0cd4aa178c2233cbc90 (diff) | |
| download | emacs-aed328bfc31b7a1430efe0901f12f09b7e7db033.tar.gz emacs-aed328bfc31b7a1430efe0901f12f09b7e7db033.zip | |
(window_scroll_pixel_based): When scrolling backwards,
handle partial visible line at end of window even when we hit PT.
| -rw-r--r-- | src/window.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c index 07b197cef75..93495afb1a5 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4763,6 +4763,7 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4763 | else if (n < 0) | 4763 | else if (n < 0) |
| 4764 | { | 4764 | { |
| 4765 | int charpos, bytepos; | 4765 | int charpos, bytepos; |
| 4766 | int partial_p; | ||
| 4766 | 4767 | ||
| 4767 | /* Save our position, for the preserve_y case. */ | 4768 | /* Save our position, for the preserve_y case. */ |
| 4768 | charpos = IT_CHARPOS (it); | 4769 | charpos = IT_CHARPOS (it); |
| @@ -4774,7 +4775,20 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4774 | it.last_visible_y - this_scroll_margin - 1, -1, | 4775 | it.last_visible_y - this_scroll_margin - 1, -1, |
| 4775 | MOVE_TO_POS | MOVE_TO_Y); | 4776 | MOVE_TO_POS | MOVE_TO_Y); |
| 4776 | 4777 | ||
| 4777 | if (IT_CHARPOS (it) == PT) | 4778 | /* Save our position, in case it's correct. */ |
| 4779 | charpos = IT_CHARPOS (it); | ||
| 4780 | bytepos = IT_BYTEPOS (it); | ||
| 4781 | |||
| 4782 | /* See if point is on a partially visible line at the end. */ | ||
| 4783 | if (it.what == IT_EOB) | ||
| 4784 | partial_p = it.current_y + it.ascent + it.descent > it.last_visible_y; | ||
| 4785 | else | ||
| 4786 | { | ||
| 4787 | move_it_by_lines (&it, 1, 1); | ||
| 4788 | partial_p = it.current_y > it.last_visible_y; | ||
| 4789 | } | ||
| 4790 | |||
| 4791 | if (charpos == PT && !partial_p) | ||
| 4778 | /* We found PT before we found the display margin, so PT is ok. */ | 4792 | /* We found PT before we found the display margin, so PT is ok. */ |
| 4779 | ; | 4793 | ; |
| 4780 | else if (preserve_y >= 0) | 4794 | else if (preserve_y >= 0) |
| @@ -4795,14 +4809,7 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4795 | } | 4809 | } |
| 4796 | else | 4810 | else |
| 4797 | { | 4811 | { |
| 4798 | /* Save our position, in case it's correct. */ | 4812 | if (partial_p) |
| 4799 | charpos = IT_CHARPOS (it); | ||
| 4800 | bytepos = IT_BYTEPOS (it); | ||
| 4801 | |||
| 4802 | /* See if point is on a partially visible line at the end. */ | ||
| 4803 | move_it_by_lines (&it, 1, 1); | ||
| 4804 | |||
| 4805 | if (it.current_y > it.last_visible_y) | ||
| 4806 | /* The last line was only partially visible, so back up two | 4813 | /* The last line was only partially visible, so back up two |
| 4807 | lines to make sure we're on a fully visible line. */ | 4814 | lines to make sure we're on a fully visible line. */ |
| 4808 | { | 4815 | { |