aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/window.c b/src/window.c
index 96b1144acf2..e3850387a64 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4662,14 +4662,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4662 4662
4663 if (pos < ZV) 4663 if (pos < ZV)
4664 { 4664 {
4665 int this_scroll_margin = scroll_margin;
4666
4667 /* Don't use a scroll margin that is negative or too large. */ 4665 /* Don't use a scroll margin that is negative or too large. */
4668 if (this_scroll_margin < 0) 4666 int this_scroll_margin =
4669 this_scroll_margin = 0; 4667 max (0, min (scroll_margin, XINT (w->total_lines) / 4));
4670
4671 if (XINT (w->total_lines) < 4 * scroll_margin)
4672 this_scroll_margin = XINT (w->total_lines) / 4;
4673 4668
4674 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); 4669 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
4675 w->start_at_line_beg = bolp; 4670 w->start_at_line_beg = bolp;
@@ -5057,7 +5052,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5057 struct buffer *obuf = current_buffer; 5052 struct buffer *obuf = current_buffer;
5058 int center_p = 0; 5053 int center_p = 0;
5059 EMACS_INT charpos, bytepos; 5054 EMACS_INT charpos, bytepos;
5060 int iarg IF_LINT (= 0); 5055 EMACS_INT iarg IF_LINT (= 0);
5061 int this_scroll_margin; 5056 int this_scroll_margin;
5062 5057
5063 /* If redisplay is suppressed due to an error, try again. */ 5058 /* If redisplay is suppressed due to an error, try again. */
@@ -5096,9 +5091,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5096 5091
5097 /* Do this after making BUF current 5092 /* Do this after making BUF current
5098 in case scroll_margin is buffer-local. */ 5093 in case scroll_margin is buffer-local. */
5099 this_scroll_margin = max (0, scroll_margin); 5094 this_scroll_margin =
5100 this_scroll_margin = min (this_scroll_margin, 5095 max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4));
5101 XFASTINT (w->total_lines) / 4);
5102 5096
5103 /* Handle centering on a graphical frame specially. Such frames can 5097 /* Handle centering on a graphical frame specially. Such frames can
5104 have variable-height lines and centering point on the basis of 5098 have variable-height lines and centering point on the basis of
@@ -5122,7 +5116,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5122 { 5116 {
5123 struct it it; 5117 struct it it;
5124 struct text_pos pt; 5118 struct text_pos pt;
5125 int nlines = -iarg; 5119 int nlines = min (INT_MAX, -iarg);
5126 int extra_line_spacing; 5120 int extra_line_spacing;
5127 int h = window_box_height (w); 5121 int h = window_box_height (w);
5128 void *itdata = bidi_shelve_cache (); 5122 void *itdata = bidi_shelve_cache ();
@@ -5288,15 +5282,14 @@ zero means top of window, negative means relative to bottom of window. */)
5288 lines = displayed_window_lines (w); 5282 lines = displayed_window_lines (w);
5289 5283
5290#if 0 5284#if 0
5291 this_scroll_margin = max (0, scroll_margin); 5285 this_scroll_margin = max (0, min (scroll_margin, lines / 4));
5292 this_scroll_margin = min (this_scroll_margin, lines / 4);
5293#endif 5286#endif
5294 5287
5295 if (NILP (arg)) 5288 if (NILP (arg))
5296 XSETFASTINT (arg, lines / 2); 5289 XSETFASTINT (arg, lines / 2);
5297 else 5290 else
5298 { 5291 {
5299 int iarg = XINT (Fprefix_numeric_value (arg)); 5292 EMACS_INT iarg = XINT (Fprefix_numeric_value (arg));
5300 5293
5301 if (iarg < 0) 5294 if (iarg < 0)
5302 iarg = iarg + lines; 5295 iarg = iarg + lines;
@@ -5468,7 +5461,8 @@ the return value is nil. Otherwise the value is t. */)
5468 struct window *root_window; 5461 struct window *root_window;
5469 struct window **leaf_windows; 5462 struct window **leaf_windows;
5470 int n_leaf_windows; 5463 int n_leaf_windows;
5471 int k, i, n; 5464 ptrdiff_t k;
5465 int i, n;
5472 5466
5473 /* If the frame has been resized since this window configuration was 5467 /* If the frame has been resized since this window configuration was
5474 made, we change the frame to the size specified in the 5468 made, we change the frame to the size specified in the
@@ -6344,7 +6338,7 @@ compare_window_configurations (Lisp_Object configuration1, Lisp_Object configura
6344{ 6338{
6345 register struct save_window_data *d1, *d2; 6339 register struct save_window_data *d1, *d2;
6346 struct Lisp_Vector *sws1, *sws2; 6340 struct Lisp_Vector *sws1, *sws2;
6347 int i; 6341 ptrdiff_t i;
6348 6342
6349 CHECK_WINDOW_CONFIGURATION (configuration1); 6343 CHECK_WINDOW_CONFIGURATION (configuration1);
6350 CHECK_WINDOW_CONFIGURATION (configuration2); 6344 CHECK_WINDOW_CONFIGURATION (configuration2);