aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/window.c b/src/window.c
index 39210b91616..3014d90ff79 100644
--- a/src/window.c
+++ b/src/window.c
@@ -63,7 +63,7 @@ static int displayed_window_lines (struct window *);
63static struct window *decode_window (Lisp_Object); 63static struct window *decode_window (Lisp_Object);
64static int count_windows (struct window *); 64static int count_windows (struct window *);
65static int get_leaf_windows (struct window *, struct window **, int); 65static int get_leaf_windows (struct window *, struct window **, int);
66static void window_scroll (Lisp_Object, int, int, int); 66static void window_scroll (Lisp_Object, EMACS_INT, int, int);
67static void window_scroll_pixel_based (Lisp_Object, int, int, int); 67static void window_scroll_pixel_based (Lisp_Object, int, int, int);
68static void window_scroll_line_based (Lisp_Object, int, int, int); 68static void window_scroll_line_based (Lisp_Object, int, int, int);
69static int freeze_window_start (struct window *, void *); 69static int freeze_window_start (struct window *, void *);
@@ -127,8 +127,8 @@ static int window_scroll_pixel_based_preserve_x;
127static int window_scroll_pixel_based_preserve_y; 127static int window_scroll_pixel_based_preserve_y;
128 128
129/* Same for window_scroll_line_based. */ 129/* Same for window_scroll_line_based. */
130static int window_scroll_preserve_hpos; 130static EMACS_INT window_scroll_preserve_hpos;
131static int window_scroll_preserve_vpos; 131static EMACS_INT window_scroll_preserve_vpos;
132 132
133static struct window * 133static struct window *
134decode_window (register Lisp_Object window) 134decode_window (register Lisp_Object window)
@@ -379,7 +379,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
379 redisplay_window has altered point after scrolling, 379 redisplay_window has altered point after scrolling,
380 because it makes the change only in the window. */ 380 because it makes the change only in the window. */
381 { 381 {
382 register EMACS_INT new_point = marker_position (w->pointm); 382 register ptrdiff_t new_point = marker_position (w->pointm);
383 if (new_point < BEGV) 383 if (new_point < BEGV)
384 SET_PT (BEGV); 384 SET_PT (BEGV);
385 else if (new_point > ZV) 385 else if (new_point > ZV)
@@ -691,10 +691,10 @@ window so that the location of point moves off-window. */)
691 (Lisp_Object window, Lisp_Object ncol) 691 (Lisp_Object window, Lisp_Object ncol)
692{ 692{
693 struct window *w = decode_window (window); 693 struct window *w = decode_window (window);
694 int hscroll; 694 ptrdiff_t hscroll;
695 695
696 CHECK_NUMBER (ncol); 696 CHECK_NUMBER (ncol);
697 hscroll = max (0, XINT (ncol)); 697 hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX);
698 698
699 /* Prevent redisplay shortcuts when changing the hscroll. */ 699 /* Prevent redisplay shortcuts when changing the hscroll. */
700 if (XINT (w->hscroll) != hscroll) 700 if (XINT (w->hscroll) != hscroll)
@@ -1526,7 +1526,8 @@ Return nil if window display is not up-to-date. In that case, use
1526 register struct window *w; 1526 register struct window *w;
1527 register struct buffer *b; 1527 register struct buffer *b;
1528 struct glyph_row *row, *end_row; 1528 struct glyph_row *row, *end_row;
1529 int max_y, crop, i, n; 1529 int max_y, crop, i;
1530 EMACS_INT n;
1530 1531
1531 w = decode_window (window); 1532 w = decode_window (window);
1532 1533
@@ -2596,7 +2597,7 @@ window-start value is reasonable when this function is called. */)
2596 struct window *w, *r, *s; 2597 struct window *w, *r, *s;
2597 struct frame *f; 2598 struct frame *f;
2598 Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; 2599 Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta;
2599 EMACS_INT startpos IF_LINT (= 0); 2600 ptrdiff_t startpos IF_LINT (= 0);
2600 int top IF_LINT (= 0), new_top, resize_failed; 2601 int top IF_LINT (= 0), new_top, resize_failed;
2601 2602
2602 w = decode_any_window (window); 2603 w = decode_any_window (window);
@@ -2925,7 +2926,7 @@ select_frame_norecord (Lisp_Object frame)
2925void 2926void
2926run_window_configuration_change_hook (struct frame *f) 2927run_window_configuration_change_hook (struct frame *f)
2927{ 2928{
2928 int count = SPECPDL_INDEX (); 2929 ptrdiff_t count = SPECPDL_INDEX ();
2929 Lisp_Object frame, global_wcch 2930 Lisp_Object frame, global_wcch
2930 = Fdefault_value (Qwindow_configuration_change_hook); 2931 = Fdefault_value (Qwindow_configuration_change_hook);
2931 XSETFRAME (frame, f); 2932 XSETFRAME (frame, f);
@@ -2956,7 +2957,7 @@ run_window_configuration_change_hook (struct frame *f)
2956 if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, 2957 if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook,
2957 buffer))) 2958 buffer)))
2958 { 2959 {
2959 int inner_count = SPECPDL_INDEX (); 2960 ptrdiff_t inner_count = SPECPDL_INDEX ();
2960 record_unwind_protect (select_window_norecord, Fselected_window ()); 2961 record_unwind_protect (select_window_norecord, Fselected_window ());
2961 select_window_norecord (window); 2962 select_window_norecord (window);
2962 run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, 2963 run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook,
@@ -2991,7 +2992,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
2991{ 2992{
2992 struct window *w = XWINDOW (window); 2993 struct window *w = XWINDOW (window);
2993 struct buffer *b = XBUFFER (buffer); 2994 struct buffer *b = XBUFFER (buffer);
2994 int count = SPECPDL_INDEX (); 2995 ptrdiff_t count = SPECPDL_INDEX ();
2995 int samebuf = EQ (buffer, w->buffer); 2996 int samebuf = EQ (buffer, w->buffer);
2996 2997
2997 w->buffer = buffer; 2998 w->buffer = buffer;
@@ -3225,7 +3226,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3225 /* Run temp-buffer-show-hook, with the chosen window selected 3226 /* Run temp-buffer-show-hook, with the chosen window selected
3226 and its buffer current. */ 3227 and its buffer current. */
3227 { 3228 {
3228 int count = SPECPDL_INDEX (); 3229 ptrdiff_t count = SPECPDL_INDEX ();
3229 Lisp_Object prev_window, prev_buffer; 3230 Lisp_Object prev_window, prev_buffer;
3230 prev_window = selected_window; 3231 prev_window = selected_window;
3231 XSETBUFFER (prev_buffer, old); 3232 XSETBUFFER (prev_buffer, old);
@@ -4212,9 +4213,10 @@ window_internal_height (struct window *w)
4212 respectively. */ 4213 respectively. */
4213 4214
4214static void 4215static void
4215window_scroll (Lisp_Object window, int n, int whole, int noerror) 4216window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror)
4216{ 4217{
4217 immediate_quit = 1; 4218 immediate_quit = 1;
4219 n = clip_to_bounds (INT_MIN, n, INT_MAX);
4218 4220
4219 /* If we must, use the pixel-based version which is much slower than 4221 /* If we must, use the pixel-based version which is much slower than
4220 the line-based one but can handle varying line heights. */ 4222 the line-based one but can handle varying line heights. */
@@ -4310,7 +4312,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4310 /* Maybe modify window start instead of scrolling. */ 4312 /* Maybe modify window start instead of scrolling. */
4311 if (rbot > 0 || w->vscroll < 0) 4313 if (rbot > 0 || w->vscroll < 0)
4312 { 4314 {
4313 EMACS_INT spos; 4315 ptrdiff_t spos;
4314 4316
4315 Fset_window_vscroll (window, make_number (0), Qt); 4317 Fset_window_vscroll (window, make_number (0), Qt);
4316 /* If there are other text lines above the current row, 4318 /* If there are other text lines above the current row,
@@ -4365,7 +4367,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4365 start_display (&it, w, start); 4367 start_display (&it, w, start);
4366 if (whole) 4368 if (whole)
4367 { 4369 {
4368 EMACS_INT start_pos = IT_CHARPOS (it); 4370 ptrdiff_t start_pos = IT_CHARPOS (it);
4369 int dy = WINDOW_FRAME_LINE_HEIGHT (w); 4371 int dy = WINDOW_FRAME_LINE_HEIGHT (w);
4370 dy = max ((window_box_height (w) 4372 dy = max ((window_box_height (w)
4371 - next_screen_context_lines * dy), 4373 - next_screen_context_lines * dy),
@@ -4452,8 +4454,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4452 4454
4453 if (! vscrolled) 4455 if (! vscrolled)
4454 { 4456 {
4455 EMACS_INT pos = IT_CHARPOS (it); 4457 ptrdiff_t pos = IT_CHARPOS (it);
4456 EMACS_INT bytepos; 4458 ptrdiff_t bytepos;
4457 4459
4458 /* If in the middle of a multi-glyph character move forward to 4460 /* If in the middle of a multi-glyph character move forward to
4459 the next character. */ 4461 the next character. */
@@ -4523,7 +4525,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4523 } 4525 }
4524 else if (n < 0) 4526 else if (n < 0)
4525 { 4527 {
4526 EMACS_INT charpos, bytepos; 4528 ptrdiff_t charpos, bytepos;
4527 int partial_p; 4529 int partial_p;
4528 4530
4529 /* Save our position, for the 4531 /* Save our position, for the
@@ -4600,12 +4602,12 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4600 in `grep-mode-font-lock-keywords'). So we use a marker to record 4602 in `grep-mode-font-lock-keywords'). So we use a marker to record
4601 the old point position, to prevent crashes in SET_PT_BOTH. */ 4603 the old point position, to prevent crashes in SET_PT_BOTH. */
4602 Lisp_Object opoint_marker = Fpoint_marker (); 4604 Lisp_Object opoint_marker = Fpoint_marker ();
4603 register EMACS_INT pos, pos_byte; 4605 register ptrdiff_t pos, pos_byte;
4604 register int ht = window_internal_height (w); 4606 register int ht = window_internal_height (w);
4605 register Lisp_Object tem; 4607 register Lisp_Object tem;
4606 int lose; 4608 int lose;
4607 Lisp_Object bolp; 4609 Lisp_Object bolp;
4608 EMACS_INT startpos; 4610 ptrdiff_t startpos;
4609 Lisp_Object original_pos = Qnil; 4611 Lisp_Object original_pos = Qnil;
4610 4612
4611 /* If scrolling screen-fulls, compute the number of lines to 4613 /* If scrolling screen-fulls, compute the number of lines to
@@ -4754,7 +4756,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4754static void 4756static void
4755scroll_command (Lisp_Object n, int direction) 4757scroll_command (Lisp_Object n, int direction)
4756{ 4758{
4757 int count = SPECPDL_INDEX (); 4759 ptrdiff_t count = SPECPDL_INDEX ();
4758 4760
4759 xassert (eabs (direction) == 1); 4761 xassert (eabs (direction) == 1);
4760 4762
@@ -4869,7 +4871,7 @@ specifies the window to scroll. This takes precedence over
4869{ 4871{
4870 Lisp_Object window; 4872 Lisp_Object window;
4871 struct window *w; 4873 struct window *w;
4872 int count = SPECPDL_INDEX (); 4874 ptrdiff_t count = SPECPDL_INDEX ();
4873 4875
4874 window = Fother_window_for_scrolling (); 4876 window = Fother_window_for_scrolling ();
4875 w = XWINDOW (window); 4877 w = XWINDOW (window);
@@ -4911,7 +4913,7 @@ by this function. This happens in an interactive call. */)
4911 (register Lisp_Object arg, Lisp_Object set_minimum) 4913 (register Lisp_Object arg, Lisp_Object set_minimum)
4912{ 4914{
4913 Lisp_Object result; 4915 Lisp_Object result;
4914 int hscroll; 4916 EMACS_INT hscroll;
4915 struct window *w = XWINDOW (selected_window); 4917 struct window *w = XWINDOW (selected_window);
4916 4918
4917 if (NILP (arg)) 4919 if (NILP (arg))
@@ -4940,7 +4942,7 @@ by this function. This happens in an interactive call. */)
4940 (register Lisp_Object arg, Lisp_Object set_minimum) 4942 (register Lisp_Object arg, Lisp_Object set_minimum)
4941{ 4943{
4942 Lisp_Object result; 4944 Lisp_Object result;
4943 int hscroll; 4945 EMACS_INT hscroll;
4944 struct window *w = XWINDOW (selected_window); 4946 struct window *w = XWINDOW (selected_window);
4945 4947
4946 if (NILP (arg)) 4948 if (NILP (arg))
@@ -5051,7 +5053,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5051 struct buffer *buf = XBUFFER (w->buffer); 5053 struct buffer *buf = XBUFFER (w->buffer);
5052 struct buffer *obuf = current_buffer; 5054 struct buffer *obuf = current_buffer;
5053 int center_p = 0; 5055 int center_p = 0;
5054 EMACS_INT charpos, bytepos; 5056 ptrdiff_t charpos, bytepos;
5055 EMACS_INT iarg IF_LINT (= 0); 5057 EMACS_INT iarg IF_LINT (= 0);
5056 int this_scroll_margin; 5058 int this_scroll_margin;
5057 5059
@@ -5400,7 +5402,7 @@ the return value is nil. Otherwise the value is t. */)
5400 Lisp_Object frame; 5402 Lisp_Object frame;
5401 Lisp_Object auto_buffer_name; 5403 Lisp_Object auto_buffer_name;
5402 FRAME_PTR f; 5404 FRAME_PTR f;
5403 EMACS_INT old_point = -1; 5405 ptrdiff_t old_point = -1;
5404 5406
5405 CHECK_WINDOW_CONFIGURATION (configuration); 5407 CHECK_WINDOW_CONFIGURATION (configuration);
5406 5408
@@ -6117,7 +6119,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6117 6119
6118 if (!NILP (width)) 6120 if (!NILP (width))
6119 { 6121 {
6120 CHECK_NATNUM (width); 6122 CHECK_RANGED_INTEGER (0, width, INT_MAX);
6121 6123
6122 if (XINT (width) == 0) 6124 if (XINT (width) == 0)
6123 vertical_type = Qnil; 6125 vertical_type = Qnil;