aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2011-03-26 16:03:23 +0200
committerEli Zaretskii2011-03-26 16:03:23 +0200
commit5d9bd9764f0c3dc7592c0232420e4bbc1e366b7f (patch)
tree285374b3f654bbaa7e60d65859378bfe8bc675f8 /src
parent665370491941c11a541eb62411147b73853e8aa3 (diff)
downloademacs-5d9bd9764f0c3dc7592c0232420e4bbc1e366b7f.tar.gz
emacs-5d9bd9764f0c3dc7592c0232420e4bbc1e366b7f.zip
Don't scroll more than 100 lines in try_scrolling.
src/xdisp.c (try_scrolling): Limit scrolling to 100 screen lines.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog1
-rw-r--r--src/xdisp.c21
2 files changed, 12 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 06972a5bcb1..83bcca1db65 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,7 @@
2 2
3 * xdisp.c (redisplay_window): Don't check buffer's clip_changed 3 * xdisp.c (redisplay_window): Don't check buffer's clip_changed
4 flag as a prerequisite for invoking try_scrolling. (Bug#6671) 4 flag as a prerequisite for invoking try_scrolling. (Bug#6671)
5 (try_scrolling): Limit scrolling to 100 screen lines.
5 6
62011-03-26 Juanma Barranquero <lekktu@gmail.com> 72011-03-26 Juanma Barranquero <lekktu@gmail.com>
7 8
diff --git a/src/xdisp.c b/src/xdisp.c
index 6f9f56df979..270d29d0213 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13016,7 +13016,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13016 int dy = 0, amount_to_scroll = 0, scroll_down_p = 0; 13016 int dy = 0, amount_to_scroll = 0, scroll_down_p = 0;
13017 int extra_scroll_margin_lines = last_line_misfit ? 1 : 0; 13017 int extra_scroll_margin_lines = last_line_misfit ? 1 : 0;
13018 Lisp_Object aggressive; 13018 Lisp_Object aggressive;
13019 int scroll_limit = INT_MAX / FRAME_LINE_HEIGHT (f); 13019 /* We will never try scrolling more than this number of lines. */
13020 int scroll_limit = 100;
13020 13021
13021#if GLYPH_DEBUG 13022#if GLYPH_DEBUG
13022 debug_method_add (w, "try_scrolling"); 13023 debug_method_add (w, "try_scrolling");
@@ -13032,14 +13033,14 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13032 else 13033 else
13033 this_scroll_margin = 0; 13034 this_scroll_margin = 0;
13034 13035
13035 /* Force arg_scroll_conservatively to have a reasonable value, to avoid 13036 /* Force arg_scroll_conservatively to have a reasonable value, to
13036 overflow while computing how much to scroll. Note that the user 13037 avoid scrolling too far away with slow move_it_* functions. Note
13037 can supply scroll-conservatively equal to `most-positive-fixnum', 13038 that the user can supply scroll-conservatively equal to
13038 which can be larger than INT_MAX. */ 13039 `most-positive-fixnum', which can be larger than INT_MAX. */
13039 if (arg_scroll_conservatively > scroll_limit) 13040 if (arg_scroll_conservatively > scroll_limit)
13040 { 13041 {
13041 arg_scroll_conservatively = scroll_limit; 13042 arg_scroll_conservatively = scroll_limit + 1;
13042 scroll_max = INT_MAX; 13043 scroll_max = scroll_limit * FRAME_LINE_HEIGHT (f);
13043 } 13044 }
13044 else if (scroll_step || arg_scroll_conservatively || temp_scroll_step) 13045 else if (scroll_step || arg_scroll_conservatively || temp_scroll_step)
13045 /* Compute how much we should try to scroll maximally to bring 13046 /* Compute how much we should try to scroll maximally to bring
@@ -13076,7 +13077,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13076 /* Compute how many pixels below window bottom to stop searching 13077 /* Compute how many pixels below window bottom to stop searching
13077 for PT. This avoids costly search for PT that is far away if 13078 for PT. This avoids costly search for PT that is far away if
13078 the user limited scrolling by a small number of lines, but 13079 the user limited scrolling by a small number of lines, but
13079 always finds PT if arg_scroll_conservatively is set to a large 13080 always finds PT if scroll_conservatively is set to a large
13080 number, such as most-positive-fixnum. */ 13081 number, such as most-positive-fixnum. */
13081 int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f)); 13082 int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f));
13082 int y_to_move = 13083 int y_to_move =
@@ -13128,12 +13129,12 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13128 return SCROLLING_FAILED; 13129 return SCROLLING_FAILED;
13129 13130
13130 start_display (&it, w, startp); 13131 start_display (&it, w, startp);
13131 if (scroll_max < INT_MAX) 13132 if (arg_scroll_conservatively <= scroll_limit)
13132 move_it_vertically (&it, amount_to_scroll); 13133 move_it_vertically (&it, amount_to_scroll);
13133 else 13134 else
13134 { 13135 {
13135 /* Extra precision for users who set scroll-conservatively 13136 /* Extra precision for users who set scroll-conservatively
13136 to most-positive-fixnum: make sure the amount we scroll 13137 to a large number: make sure the amount we scroll
13137 the window start is never less than amount_to_scroll, 13138 the window start is never less than amount_to_scroll,
13138 which was computed as distance from window bottom to 13139 which was computed as distance from window bottom to
13139 point. This matters when lines at window top and lines 13140 point. This matters when lines at window top and lines