aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJoakim Verona2011-09-05 10:37:16 +0200
committerJoakim Verona2011-09-05 10:37:16 +0200
commit687faaf59cdf4029b5e8da16965b257592059e37 (patch)
treec19fc758dc421ec1e6619de88d7cd70258927b47 /src/window.c
parentd47f8c5baeaa804548a73675077c8e37cdfe5142 (diff)
parentf62bd846552a090f3ba5e136d6d9cdb4c07ed7be (diff)
downloademacs-687faaf59cdf4029b5e8da16965b257592059e37.tar.gz
emacs-687faaf59cdf4029b5e8da16965b257592059e37.zip
upstream
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 c8266696b2d..33361b5ac1d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4667,14 +4667,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4667 4667
4668 if (pos < ZV) 4668 if (pos < ZV)
4669 { 4669 {
4670 int this_scroll_margin = scroll_margin;
4671
4672 /* Don't use a scroll margin that is negative or too large. */ 4670 /* Don't use a scroll margin that is negative or too large. */
4673 if (this_scroll_margin < 0) 4671 int this_scroll_margin =
4674 this_scroll_margin = 0; 4672 max (0, min (scroll_margin, XINT (w->total_lines) / 4));
4675
4676 if (XINT (w->total_lines) < 4 * scroll_margin)
4677 this_scroll_margin = XINT (w->total_lines) / 4;
4678 4673
4679 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); 4674 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
4680 w->start_at_line_beg = bolp; 4675 w->start_at_line_beg = bolp;
@@ -5062,7 +5057,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5062 struct buffer *obuf = current_buffer; 5057 struct buffer *obuf = current_buffer;
5063 int center_p = 0; 5058 int center_p = 0;
5064 EMACS_INT charpos, bytepos; 5059 EMACS_INT charpos, bytepos;
5065 int iarg IF_LINT (= 0); 5060 EMACS_INT iarg IF_LINT (= 0);
5066 int this_scroll_margin; 5061 int this_scroll_margin;
5067 5062
5068 /* If redisplay is suppressed due to an error, try again. */ 5063 /* If redisplay is suppressed due to an error, try again. */
@@ -5101,9 +5096,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5101 5096
5102 /* Do this after making BUF current 5097 /* Do this after making BUF current
5103 in case scroll_margin is buffer-local. */ 5098 in case scroll_margin is buffer-local. */
5104 this_scroll_margin = max (0, scroll_margin); 5099 this_scroll_margin =
5105 this_scroll_margin = min (this_scroll_margin, 5100 max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4));
5106 XFASTINT (w->total_lines) / 4);
5107 5101
5108 /* Handle centering on a graphical frame specially. Such frames can 5102 /* Handle centering on a graphical frame specially. Such frames can
5109 have variable-height lines and centering point on the basis of 5103 have variable-height lines and centering point on the basis of
@@ -5127,7 +5121,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5127 { 5121 {
5128 struct it it; 5122 struct it it;
5129 struct text_pos pt; 5123 struct text_pos pt;
5130 int nlines = -iarg; 5124 int nlines = min (INT_MAX, -iarg);
5131 int extra_line_spacing; 5125 int extra_line_spacing;
5132 int h = window_box_height (w); 5126 int h = window_box_height (w);
5133 void *itdata = bidi_shelve_cache (); 5127 void *itdata = bidi_shelve_cache ();
@@ -5293,15 +5287,14 @@ zero means top of window, negative means relative to bottom of window. */)
5293 lines = displayed_window_lines (w); 5287 lines = displayed_window_lines (w);
5294 5288
5295#if 0 5289#if 0
5296 this_scroll_margin = max (0, scroll_margin); 5290 this_scroll_margin = max (0, min (scroll_margin, lines / 4));
5297 this_scroll_margin = min (this_scroll_margin, lines / 4);
5298#endif 5291#endif
5299 5292
5300 if (NILP (arg)) 5293 if (NILP (arg))
5301 XSETFASTINT (arg, lines / 2); 5294 XSETFASTINT (arg, lines / 2);
5302 else 5295 else
5303 { 5296 {
5304 int iarg = XINT (Fprefix_numeric_value (arg)); 5297 EMACS_INT iarg = XINT (Fprefix_numeric_value (arg));
5305 5298
5306 if (iarg < 0) 5299 if (iarg < 0)
5307 iarg = iarg + lines; 5300 iarg = iarg + lines;
@@ -5473,7 +5466,8 @@ the return value is nil. Otherwise the value is t. */)
5473 struct window *root_window; 5466 struct window *root_window;
5474 struct window **leaf_windows; 5467 struct window **leaf_windows;
5475 int n_leaf_windows; 5468 int n_leaf_windows;
5476 int k, i, n; 5469 ptrdiff_t k;
5470 int i, n;
5477 5471
5478 /* If the frame has been resized since this window configuration was 5472 /* If the frame has been resized since this window configuration was
5479 made, we change the frame to the size specified in the 5473 made, we change the frame to the size specified in the
@@ -6349,7 +6343,7 @@ compare_window_configurations (Lisp_Object configuration1, Lisp_Object configura
6349{ 6343{
6350 register struct save_window_data *d1, *d2; 6344 register struct save_window_data *d1, *d2;
6351 struct Lisp_Vector *sws1, *sws2; 6345 struct Lisp_Vector *sws1, *sws2;
6352 int i; 6346 ptrdiff_t i;
6353 6347
6354 CHECK_WINDOW_CONFIGURATION (configuration1); 6348 CHECK_WINDOW_CONFIGURATION (configuration1);
6355 CHECK_WINDOW_CONFIGURATION (configuration2); 6349 CHECK_WINDOW_CONFIGURATION (configuration2);