aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-06-28 16:29:37 +0400
committerDmitry Antipov2012-06-28 16:29:37 +0400
commit80b00b0885b8e124a208dfc9de95d2039a101108 (patch)
tree8954c62ff23338f8a2c6063cccab6d40d8707e02 /src
parent62b2bcf611f144f4dea5a073a362e187970609f6 (diff)
downloademacs-80b00b0885b8e124a208dfc9de95d2039a101108.tar.gz
emacs-80b00b0885b8e124a208dfc9de95d2039a101108.zip
* window.h (struct window): Change type of 'hscroll',
'min_hscroll' and 'last_point' from Lisp_Object to ptrdiff_t, 'last_modified' and 'last_overlay_modified' to EMACS_INT. Adjust users accordingly. * xdisp.c (try_cursor_movement): Replace type check with eassert. * window.c (Fscroll_left, Fscroll_right): Change type of 'hscroll' from EMACS_INT to ptrdiff_t. (make_window): Omit redundant initialization.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/frame.c2
-rw-r--r--src/indent.c2
-rw-r--r--src/minibuf.c6
-rw-r--r--src/window.c81
-rw-r--r--src/window.h33
-rw-r--r--src/xdisp.c97
7 files changed, 123 insertions, 109 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 01a937d64f6..7bb418fab5a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-06-28 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * window.h (struct window): Change type of 'hscroll',
4 'min_hscroll' and 'last_point' from Lisp_Object to ptrdiff_t,
5 'last_modified' and 'last_overlay_modified' to EMACS_INT.
6 Adjust users accordingly.
7 * xdisp.c (try_cursor_movement): Replace type check with eassert.
8 * window.c (Fscroll_left, Fscroll_right): Change type of 'hscroll'
9 from EMACS_INT to ptrdiff_t.
10 (make_window): Omit redundant initialization.
11
12012-06-28 Juanma Barranquero <lekktu@gmail.com> 122012-06-28 Juanma Barranquero <lekktu@gmail.com>
2 13
3 * makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies. 14 * makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies.
diff --git a/src/frame.c b/src/frame.c
index f9a557f4424..6ff336c40ee 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -131,7 +131,7 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
131{ 131{
132 struct window *w = XWINDOW (window); 132 struct window *w = XWINDOW (window);
133 133
134 XSETFASTINT (w->last_modified, 0); 134 w->last_modified = 0;
135 XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n); 135 XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n);
136 XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n); 136 XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n);
137 137
diff --git a/src/indent.c b/src/indent.c
index 88cc0ab4798..ec0977d5372 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1817,7 +1817,7 @@ static struct position val_vmotion;
1817struct position * 1817struct position *
1818vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) 1818vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1819{ 1819{
1820 ptrdiff_t hscroll = XINT (w->hscroll); 1820 ptrdiff_t hscroll = w->hscroll;
1821 struct position pos; 1821 struct position pos;
1822 /* vpos is cumulative vertical position, changed as from is changed */ 1822 /* vpos is cumulative vertical position, changed as from is changed */
1823 register EMACS_INT vpos = 0; 1823 register EMACS_INT vpos = 0;
diff --git a/src/minibuf.c b/src/minibuf.c
index b0f4e3db6c1..7df230341dd 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -622,7 +622,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
622 /* Display this minibuffer in the proper window. */ 622 /* Display this minibuffer in the proper window. */
623 Fset_window_buffer (minibuf_window, Fcurrent_buffer (), Qnil); 623 Fset_window_buffer (minibuf_window, Fcurrent_buffer (), Qnil);
624 Fselect_window (minibuf_window, Qnil); 624 Fselect_window (minibuf_window, Qnil);
625 XSETFASTINT (XWINDOW (minibuf_window)->hscroll, 0); 625 XWINDOW (minibuf_window)->hscroll = 0;
626 626
627 Fmake_local_variable (Qprint_escape_newlines); 627 Fmake_local_variable (Qprint_escape_newlines);
628 print_escape_newlines = 1; 628 print_escape_newlines = 1;
@@ -888,8 +888,8 @@ read_minibuf_unwind (Lisp_Object data)
888 888
889 /* Make sure minibuffer window is erased, not ignored. */ 889 /* Make sure minibuffer window is erased, not ignored. */
890 windows_or_buffers_changed++; 890 windows_or_buffers_changed++;
891 XSETFASTINT (XWINDOW (window)->last_modified, 0); 891 XWINDOW (window)->last_modified = 0;
892 XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0); 892 XWINDOW (window)->last_overlay_modified = 0;
893 893
894 /* In case the previous minibuffer displayed in this miniwindow is 894 /* In case the previous minibuffer displayed in this miniwindow is
895 dead, we may keep displaying this buffer (tho it's inactive), so reset it, 895 dead, we may keep displaying this buffer (tho it's inactive), so reset it,
diff --git a/src/window.c b/src/window.c
index 55d6ac7a6ee..4f3d40c51e3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -667,7 +667,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
667WINDOW must be a live window and defaults to the selected one. */) 667WINDOW must be a live window and defaults to the selected one. */)
668 (Lisp_Object window) 668 (Lisp_Object window)
669{ 669{
670 return decode_window (window)->hscroll; 670 return make_number (decode_window (window)->hscroll);
671} 671}
672 672
673DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, 673DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
@@ -686,10 +686,10 @@ window so that the location of point moves off-window. */)
686 hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); 686 hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX);
687 687
688 /* Prevent redisplay shortcuts when changing the hscroll. */ 688 /* Prevent redisplay shortcuts when changing the hscroll. */
689 if (XINT (w->hscroll) != hscroll) 689 if (w->hscroll != hscroll)
690 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 690 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
691 691
692 w->hscroll = make_number (hscroll); 692 w->hscroll = hscroll;
693 return ncol; 693 return ncol;
694} 694}
695 695
@@ -1313,8 +1313,8 @@ if it isn't already recorded. */)
1313 1313
1314 if (! NILP (update) 1314 if (! NILP (update)
1315 && ! (! NILP (w->window_end_valid) 1315 && ! (! NILP (w->window_end_valid)
1316 && XFASTINT (w->last_modified) >= BUF_MODIFF (b) 1316 && w->last_modified >= BUF_MODIFF (b)
1317 && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b)) 1317 && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b))
1318 && !noninteractive) 1318 && !noninteractive)
1319 { 1319 {
1320 struct text_pos startp; 1320 struct text_pos startp;
@@ -1397,8 +1397,8 @@ overriding motion of point in order to display at this exact start. */)
1397 if (NILP (noforce)) 1397 if (NILP (noforce))
1398 w->force_start = 1; 1398 w->force_start = 1;
1399 w->update_mode_line = 1; 1399 w->update_mode_line = 1;
1400 XSETFASTINT (w->last_modified, 0); 1400 w->last_modified = 0;
1401 XSETFASTINT (w->last_overlay_modified, 0); 1401 w->last_overlay_modified = 0;
1402 if (!EQ (window, selected_window)) 1402 if (!EQ (window, selected_window))
1403 windows_or_buffers_changed++; 1403 windows_or_buffers_changed++;
1404 1404
@@ -1510,8 +1510,8 @@ Return nil if window display is not up-to-date. In that case, use
1510 if (NILP (w->window_end_valid) 1510 if (NILP (w->window_end_valid)
1511 || current_buffer->clip_changed 1511 || current_buffer->clip_changed
1512 || current_buffer->prevent_redisplay_optimizations_p 1512 || current_buffer->prevent_redisplay_optimizations_p
1513 || XFASTINT (w->last_modified) < BUF_MODIFF (b) 1513 || w->last_modified < BUF_MODIFF (b)
1514 || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) 1514 || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b))
1515 return Qnil; 1515 return Qnil;
1516 1516
1517 if (NILP (line)) 1517 if (NILP (line))
@@ -3002,7 +3002,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3002 Resetting hscroll and vscroll here is problematic for things like 3002 Resetting hscroll and vscroll here is problematic for things like
3003 image-mode and doc-view-mode since it resets the image's position 3003 image-mode and doc-view-mode since it resets the image's position
3004 whenever we resize the frame. */ 3004 whenever we resize the frame. */
3005 w->hscroll = w->min_hscroll = make_number (0); 3005 w->hscroll = w->min_hscroll = 0;
3006 w->vscroll = 0; 3006 w->vscroll = 0;
3007 set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); 3007 set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
3008 set_marker_restricted (w->start, 3008 set_marker_restricted (w->start,
@@ -3010,8 +3010,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3010 buffer); 3010 buffer);
3011 w->start_at_line_beg = 0; 3011 w->start_at_line_beg = 0;
3012 w->force_start = 0; 3012 w->force_start = 0;
3013 XSETFASTINT (w->last_modified, 0); 3013 w->last_modified = 0;
3014 XSETFASTINT (w->last_overlay_modified, 0); 3014 w->last_overlay_modified = 0;
3015 } 3015 }
3016 /* Maybe we could move this into the `if' but it's not obviously safe and 3016 /* Maybe we could move this into the `if' but it's not obviously safe and
3017 I doubt it's worth the trouble. */ 3017 I doubt it's worth the trouble. */
@@ -3196,8 +3196,8 @@ temp_output_buffer_show (register Lisp_Object buf)
3196 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); 3196 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
3197 Vminibuf_scroll_window = window; 3197 Vminibuf_scroll_window = window;
3198 w = XWINDOW (window); 3198 w = XWINDOW (window);
3199 XSETFASTINT (w->hscroll, 0); 3199 w->hscroll = 0;
3200 XSETFASTINT (w->min_hscroll, 0); 3200 w->min_hscroll = 0;
3201 set_marker_restricted_both (w->start, buf, BEG, BEG); 3201 set_marker_restricted_both (w->start, buf, BEG, BEG);
3202 set_marker_restricted_both (w->pointm, buf, BEG, BEG); 3202 set_marker_restricted_both (w->pointm, buf, BEG, BEG);
3203 3203
@@ -3286,9 +3286,6 @@ make_window (void)
3286 XSETFASTINT (w->new_normal, 0); 3286 XSETFASTINT (w->new_normal, 0);
3287 w->start = Fmake_marker (); 3287 w->start = Fmake_marker ();
3288 w->pointm = Fmake_marker (); 3288 w->pointm = Fmake_marker ();
3289 XSETFASTINT (w->hscroll, 0);
3290 XSETFASTINT (w->min_hscroll, 0);
3291 XSETFASTINT (w->last_point, 0);
3292 w->vertical_scroll_bar_type = Qt; 3289 w->vertical_scroll_bar_type = Qt;
3293 XSETFASTINT (w->window_end_pos, 0); 3290 XSETFASTINT (w->window_end_pos, 0);
3294 XSETFASTINT (w->window_end_vpos, 0); 3291 XSETFASTINT (w->window_end_vpos, 0);
@@ -3488,8 +3485,8 @@ window_resize_apply (struct window *w, int horflag)
3488 } 3485 }
3489 3486
3490 /* Clear out some redisplay caches. */ 3487 /* Clear out some redisplay caches. */
3491 XSETFASTINT (w->last_modified, 0); 3488 w->last_modified = 0;
3492 XSETFASTINT (w->last_overlay_modified, 0); 3489 w->last_overlay_modified = 0;
3493} 3490}
3494 3491
3495 3492
@@ -4021,8 +4018,8 @@ grow_mini_window (struct window *w, int delta)
4021 /* Grow the mini-window. */ 4018 /* Grow the mini-window. */
4022 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); 4019 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
4023 XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); 4020 XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value));
4024 XSETFASTINT (w->last_modified, 0); 4021 w->last_modified = 0;
4025 XSETFASTINT (w->last_overlay_modified, 0); 4022 w->last_overlay_modified = 0;
4026 4023
4027 adjust_glyphs (f); 4024 adjust_glyphs (f);
4028 UNBLOCK_INPUT; 4025 UNBLOCK_INPUT;
@@ -4057,8 +4054,8 @@ shrink_mini_window (struct window *w)
4057 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); 4054 XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
4058 XSETFASTINT (w->total_lines, 1); 4055 XSETFASTINT (w->total_lines, 1);
4059 4056
4060 XSETFASTINT (w->last_modified, 0); 4057 w->last_modified = 0;
4061 XSETFASTINT (w->last_overlay_modified, 0); 4058 w->last_overlay_modified = 0;
4062 4059
4063 adjust_glyphs (f); 4060 adjust_glyphs (f);
4064 UNBLOCK_INPUT; 4061 UNBLOCK_INPUT;
@@ -4285,8 +4282,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4285 w->buffer); 4282 w->buffer);
4286 w->start_at_line_beg = 1; 4283 w->start_at_line_beg = 1;
4287 w->update_mode_line = 1; 4284 w->update_mode_line = 1;
4288 XSETFASTINT (w->last_modified, 0); 4285 w->last_modified = 0;
4289 XSETFASTINT (w->last_overlay_modified, 0); 4286 w->last_overlay_modified = 0;
4290 /* Set force_start so that redisplay_window will run the 4287 /* Set force_start so that redisplay_window will run the
4291 window-scroll-functions. */ 4288 window-scroll-functions. */
4292 w->force_start = 1; 4289 w->force_start = 1;
@@ -4431,8 +4428,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
4431 bytepos = XMARKER (w->start)->bytepos; 4428 bytepos = XMARKER (w->start)->bytepos;
4432 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); 4429 w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
4433 w->update_mode_line = 1; 4430 w->update_mode_line = 1;
4434 XSETFASTINT (w->last_modified, 0); 4431 w->last_modified = 0;
4435 XSETFASTINT (w->last_overlay_modified, 0); 4432 w->last_overlay_modified = 0;
4436 /* Set force_start so that redisplay_window will run the 4433 /* Set force_start so that redisplay_window will run the
4437 window-scroll-functions. */ 4434 window-scroll-functions. */
4438 w->force_start = 1; 4435 w->force_start = 1;
@@ -4585,10 +4582,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4585 struct position posit 4582 struct position posit
4586 = *compute_motion (startpos, 0, 0, 0, 4583 = *compute_motion (startpos, 0, 0, 0,
4587 PT, ht, 0, 4584 PT, ht, 0,
4588 -1, XINT (w->hscroll), 4585 -1, w->hscroll,
4589 0, w); 4586 0, w);
4590 window_scroll_preserve_vpos = posit.vpos; 4587 window_scroll_preserve_vpos = posit.vpos;
4591 window_scroll_preserve_hpos = posit.hpos + XINT (w->hscroll); 4588 window_scroll_preserve_hpos = posit.hpos + w->hscroll;
4592 } 4589 }
4593 4590
4594 original_pos = Fcons (make_number (window_scroll_preserve_hpos), 4591 original_pos = Fcons (make_number (window_scroll_preserve_hpos),
@@ -4630,8 +4627,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
4630 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); 4627 set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
4631 w->start_at_line_beg = !NILP (bolp); 4628 w->start_at_line_beg = !NILP (bolp);
4632 w->update_mode_line = 1; 4629 w->update_mode_line = 1;
4633 XSETFASTINT (w->last_modified, 0); 4630 w->last_modified = 0;
4634 XSETFASTINT (w->last_overlay_modified, 0); 4631 w->last_overlay_modified = 0;
4635 /* Set force_start so that redisplay_window will run 4632 /* Set force_start so that redisplay_window will run
4636 the window-scroll-functions. */ 4633 the window-scroll-functions. */
4637 w->force_start = 1; 4634 w->force_start = 1;
@@ -4872,7 +4869,7 @@ by this function. This happens in an interactive call. */)
4872 (register Lisp_Object arg, Lisp_Object set_minimum) 4869 (register Lisp_Object arg, Lisp_Object set_minimum)
4873{ 4870{
4874 Lisp_Object result; 4871 Lisp_Object result;
4875 EMACS_INT hscroll; 4872 ptrdiff_t hscroll;
4876 struct window *w = XWINDOW (selected_window); 4873 struct window *w = XWINDOW (selected_window);
4877 4874
4878 if (NILP (arg)) 4875 if (NILP (arg))
@@ -4880,7 +4877,7 @@ by this function. This happens in an interactive call. */)
4880 else 4877 else
4881 arg = Fprefix_numeric_value (arg); 4878 arg = Fprefix_numeric_value (arg);
4882 4879
4883 hscroll = XINT (w->hscroll) + XINT (arg); 4880 hscroll = w->hscroll + XINT (arg);
4884 result = Fset_window_hscroll (selected_window, make_number (hscroll)); 4881 result = Fset_window_hscroll (selected_window, make_number (hscroll));
4885 4882
4886 if (!NILP (set_minimum)) 4883 if (!NILP (set_minimum))
@@ -4901,7 +4898,7 @@ by this function. This happens in an interactive call. */)
4901 (register Lisp_Object arg, Lisp_Object set_minimum) 4898 (register Lisp_Object arg, Lisp_Object set_minimum)
4902{ 4899{
4903 Lisp_Object result; 4900 Lisp_Object result;
4904 EMACS_INT hscroll; 4901 ptrdiff_t hscroll;
4905 struct window *w = XWINDOW (selected_window); 4902 struct window *w = XWINDOW (selected_window);
4906 4903
4907 if (NILP (arg)) 4904 if (NILP (arg))
@@ -4909,7 +4906,7 @@ by this function. This happens in an interactive call. */)
4909 else 4906 else
4910 arg = Fprefix_numeric_value (arg); 4907 arg = Fprefix_numeric_value (arg);
4911 4908
4912 hscroll = XINT (w->hscroll) - XINT (arg); 4909 hscroll = w->hscroll - XINT (arg);
4913 result = Fset_window_hscroll (selected_window, make_number (hscroll)); 4910 result = Fset_window_hscroll (selected_window, make_number (hscroll));
4914 4911
4915 if (!NILP (set_minimum)) 4912 if (!NILP (set_minimum))
@@ -5537,8 +5534,8 @@ the return value is nil. Otherwise the value is t. */)
5537 w->total_lines = p->total_lines; 5534 w->total_lines = p->total_lines;
5538 w->normal_cols = p->normal_cols; 5535 w->normal_cols = p->normal_cols;
5539 w->normal_lines = p->normal_lines; 5536 w->normal_lines = p->normal_lines;
5540 w->hscroll = p->hscroll; 5537 w->hscroll = XFASTINT (p->hscroll);
5541 w->min_hscroll = p->min_hscroll; 5538 w->min_hscroll = XFASTINT (p->min_hscroll);
5542 w->display_table = p->display_table; 5539 w->display_table = p->display_table;
5543 w->left_margin_cols = p->left_margin_cols; 5540 w->left_margin_cols = p->left_margin_cols;
5544 w->right_margin_cols = p->right_margin_cols; 5541 w->right_margin_cols = p->right_margin_cols;
@@ -5571,8 +5568,8 @@ the return value is nil. Otherwise the value is t. */)
5571 } 5568 }
5572 } 5569 }
5573 5570
5574 XSETFASTINT (w->last_modified, 0); 5571 w->last_modified = 0;
5575 XSETFASTINT (w->last_overlay_modified, 0); 5572 w->last_overlay_modified = 0;
5576 5573
5577 /* Reinstall the saved buffer and pointers into it. */ 5574 /* Reinstall the saved buffer and pointers into it. */
5578 if (NILP (p->buffer)) 5575 if (NILP (p->buffer))
@@ -5811,7 +5808,7 @@ get_phys_cursor_glyph (struct window *w)
5811 if (!row->enabled_p) 5808 if (!row->enabled_p)
5812 return NULL; 5809 return NULL;
5813 5810
5814 if (XINT (w->hscroll)) 5811 if (w->hscroll)
5815 { 5812 {
5816 /* When the window is hscrolled, cursor hpos can legitimately be 5813 /* When the window is hscrolled, cursor hpos can legitimately be
5817 out of bounds, but we draw the cursor at the corresponding 5814 out of bounds, but we draw the cursor at the corresponding
@@ -5853,8 +5850,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5853 p->total_lines = w->total_lines; 5850 p->total_lines = w->total_lines;
5854 p->normal_cols = w->normal_cols; 5851 p->normal_cols = w->normal_cols;
5855 p->normal_lines = w->normal_lines; 5852 p->normal_lines = w->normal_lines;
5856 p->hscroll = w->hscroll; 5853 XSETFASTINT (p->hscroll, w->hscroll);
5857 p->min_hscroll = w->min_hscroll; 5854 XSETFASTINT (p->min_hscroll, w->min_hscroll);
5858 p->display_table = w->display_table; 5855 p->display_table = w->display_table;
5859 p->left_margin_cols = w->left_margin_cols; 5856 p->left_margin_cols = w->left_margin_cols;
5860 p->right_margin_cols = w->right_margin_cols; 5857 p->right_margin_cols = w->right_margin_cols;
diff --git a/src/window.h b/src/window.h
index 996c966b053..50bd7134f27 100644
--- a/src/window.h
+++ b/src/window.h
@@ -141,24 +141,10 @@ struct window
141 each one can have its own value of point. */ 141 each one can have its own value of point. */
142 Lisp_Object pointm; 142 Lisp_Object pointm;
143 143
144 /* Number of columns display within the window is scrolled to the left. */
145 Lisp_Object hscroll;
146 /* Minimum hscroll for automatic hscrolling. This is the value
147 the user has set, by set-window-hscroll for example. */
148 Lisp_Object min_hscroll;
149
150 /* No permanent meaning; used by save-window-excursion's 144 /* No permanent meaning; used by save-window-excursion's
151 bookkeeping. */ 145 bookkeeping. */
152 Lisp_Object temslot; 146 Lisp_Object temslot;
153 147
154 /* text.modified of displayed buffer as of last time display
155 completed. */
156 Lisp_Object last_modified;
157 /* BUF_OVERLAY_MODIFIED of displayed buffer as of last complete update. */
158 Lisp_Object last_overlay_modified;
159 /* Value of point at that time. */
160 Lisp_Object last_point;
161
162 /* This window's vertical scroll bar. This field is only for use 148 /* This window's vertical scroll bar. This field is only for use
163 by the window-system-dependent code which implements the 149 by the window-system-dependent code which implements the
164 scroll bars; it can store anything it likes here. If this 150 scroll bars; it can store anything it likes here. If this
@@ -254,6 +240,25 @@ struct window
254 /* Unique number of window assigned when it was created. */ 240 /* Unique number of window assigned when it was created. */
255 int sequence_number; 241 int sequence_number;
256 242
243 /* Number of columns display within the window is scrolled to the left. */
244 ptrdiff_t hscroll;
245
246 /* Minimum hscroll for automatic hscrolling. This is the value
247 the user has set, by set-window-hscroll for example. */
248 ptrdiff_t min_hscroll;
249
250 /* Displayed buffer's text modification events counter as of last time
251 display completed. */
252 EMACS_INT last_modified;
253
254 /* Displayed buffer's overlays modification events counter as of last
255 complete update. */
256 EMACS_INT last_overlay_modified;
257
258 /* Value of point at that time. Since this is a position in a buffer,
259 it should be positive. */
260 ptrdiff_t last_point;
261
257 /* Scaling factor for the glyph_matrix size calculation in this window. 262 /* Scaling factor for the glyph_matrix size calculation in this window.
258 Used if window contains many small images or uses proportional fonts, 263 Used if window contains many small images or uses proportional fonts,
259 as the normal may yield a matrix which is too small. */ 264 as the normal may yield a matrix which is too small. */
diff --git a/src/xdisp.c b/src/xdisp.c
index 425ccc522de..ae06355ac60 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1562,8 +1562,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1562 1562
1563 current_header_line_height = current_mode_line_height = -1; 1563 current_header_line_height = current_mode_line_height = -1;
1564 1564
1565 if (visible_p && XFASTINT (w->hscroll) > 0) 1565 if (visible_p && w->hscroll > 0)
1566 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); 1566 *x -= w->hscroll * WINDOW_FRAME_COLUMN_WIDTH (w);
1567 1567
1568#if 0 1568#if 0
1569 /* Debugging code. */ 1569 /* Debugging code. */
@@ -2697,7 +2697,7 @@ init_iterator (struct it *it, struct window *w,
2697 2697
2698 /* Are lines in the display truncated? */ 2698 /* Are lines in the display truncated? */
2699 if (base_face_id != DEFAULT_FACE_ID 2699 if (base_face_id != DEFAULT_FACE_ID
2700 || XINT (it->w->hscroll) 2700 || it->w->hscroll
2701 || (! WINDOW_FULL_WIDTH_P (it->w) 2701 || (! WINDOW_FULL_WIDTH_P (it->w)
2702 && ((!NILP (Vtruncate_partial_width_windows) 2702 && ((!NILP (Vtruncate_partial_width_windows)
2703 && !INTEGERP (Vtruncate_partial_width_windows)) 2703 && !INTEGERP (Vtruncate_partial_width_windows))
@@ -2760,7 +2760,7 @@ init_iterator (struct it *it, struct window *w,
2760 else 2760 else
2761 { 2761 {
2762 it->first_visible_x 2762 it->first_visible_x
2763 = XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f); 2763 = it->w->hscroll * FRAME_COLUMN_WIDTH (it->f);
2764 it->last_visible_x = (it->first_visible_x 2764 it->last_visible_x = (it->first_visible_x
2765 + window_box_width (w, TEXT_AREA)); 2765 + window_box_width (w, TEXT_AREA));
2766 2766
@@ -12309,7 +12309,7 @@ hscroll_window_tree (Lisp_Object window)
12309 inside the left margin and the window is already 12309 inside the left margin and the window is already
12310 hscrolled. */ 12310 hscrolled. */
12311 && ((!row_r2l_p 12311 && ((!row_r2l_p
12312 && ((XFASTINT (w->hscroll) 12312 && ((w->hscroll
12313 && w->cursor.x <= h_margin) 12313 && w->cursor.x <= h_margin)
12314 || (cursor_row->enabled_p 12314 || (cursor_row->enabled_p
12315 && cursor_row->truncated_on_right_p 12315 && cursor_row->truncated_on_right_p
@@ -12327,7 +12327,7 @@ hscroll_window_tree (Lisp_Object window)
12327 are actually truncated on the left. */ 12327 are actually truncated on the left. */
12328 && cursor_row->truncated_on_right_p 12328 && cursor_row->truncated_on_right_p
12329 && w->cursor.x <= h_margin) 12329 && w->cursor.x <= h_margin)
12330 || (XFASTINT (w->hscroll) 12330 || (w->hscroll
12331 && (w->cursor.x >= text_area_width - h_margin)))))) 12331 && (w->cursor.x >= text_area_width - h_margin))))))
12332 { 12332 {
12333 struct it it; 12333 struct it it;
@@ -12388,15 +12388,15 @@ hscroll_window_tree (Lisp_Object window)
12388 hscroll 12388 hscroll
12389 = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f); 12389 = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
12390 } 12390 }
12391 hscroll = max (hscroll, XFASTINT (w->min_hscroll)); 12391 hscroll = max (hscroll, w->min_hscroll);
12392 12392
12393 /* Don't prevent redisplay optimizations if hscroll 12393 /* Don't prevent redisplay optimizations if hscroll
12394 hasn't changed, as it will unnecessarily slow down 12394 hasn't changed, as it will unnecessarily slow down
12395 redisplay. */ 12395 redisplay. */
12396 if (XFASTINT (w->hscroll) != hscroll) 12396 if (w->hscroll != hscroll)
12397 { 12397 {
12398 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; 12398 XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
12399 w->hscroll = make_number (hscroll); 12399 w->hscroll = hscroll;
12400 hscrolled_p = 1; 12400 hscrolled_p = 1;
12401 } 12401 }
12402 } 12402 }
@@ -12508,8 +12508,8 @@ text_outside_line_unchanged_p (struct window *w,
12508 int unchanged_p = 1; 12508 int unchanged_p = 1;
12509 12509
12510 /* If text or overlays have changed, see where. */ 12510 /* If text or overlays have changed, see where. */
12511 if (XFASTINT (w->last_modified) < MODIFF 12511 if (w->last_modified < MODIFF
12512 || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF) 12512 || w->last_overlay_modified < OVERLAY_MODIFF)
12513 { 12513 {
12514 /* Gap in the line? */ 12514 /* Gap in the line? */
12515 if (GPT < start || Z - GPT < end) 12515 if (GPT < start || Z - GPT < end)
@@ -12788,9 +12788,9 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
12788 pt = marker_position (w->pointm); 12788 pt = marker_position (w->pointm);
12789 12789
12790 if ((w->current_matrix->buffer != XBUFFER (w->buffer) 12790 if ((w->current_matrix->buffer != XBUFFER (w->buffer)
12791 || pt != XINT (w->last_point)) 12791 || pt != w->last_point)
12792 && check_point_in_composition (w->current_matrix->buffer, 12792 && check_point_in_composition (w->current_matrix->buffer,
12793 XINT (w->last_point), 12793 w->last_point,
12794 XBUFFER (w->buffer), pt)) 12794 XBUFFER (w->buffer), pt))
12795 b->clip_changed = 1; 12795 b->clip_changed = 1;
12796 } 12796 }
@@ -13012,9 +13012,9 @@ redisplay_internal (void)
13012 if (!NILP (w->column_number_displayed) 13012 if (!NILP (w->column_number_displayed)
13013 /* This alternative quickly identifies a common case 13013 /* This alternative quickly identifies a common case
13014 where no change is needed. */ 13014 where no change is needed. */
13015 && !(PT == XFASTINT (w->last_point) 13015 && !(PT == w->last_point
13016 && XFASTINT (w->last_modified) >= MODIFF 13016 && w->last_modified >= MODIFF
13017 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) 13017 && w->last_overlay_modified >= OVERLAY_MODIFF)
13018 && (XFASTINT (w->column_number_displayed) != current_column ())) 13018 && (XFASTINT (w->column_number_displayed) != current_column ()))
13019 w->update_mode_line = 1; 13019 w->update_mode_line = 1;
13020 13020
@@ -13077,8 +13077,8 @@ redisplay_internal (void)
13077 } 13077 }
13078 else if (EQ (selected_window, minibuf_window) 13078 else if (EQ (selected_window, minibuf_window)
13079 && (current_buffer->clip_changed 13079 && (current_buffer->clip_changed
13080 || XFASTINT (w->last_modified) < MODIFF 13080 || w->last_modified < MODIFF
13081 || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF) 13081 || w->last_overlay_modified < OVERLAY_MODIFF)
13082 && resize_mini_window (w, 0)) 13082 && resize_mini_window (w, 0))
13083 { 13083 {
13084 /* Resized active mini-window to fit the size of what it is 13084 /* Resized active mini-window to fit the size of what it is
@@ -13143,8 +13143,8 @@ redisplay_internal (void)
13143 || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n')) 13143 || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n'))
13144 /* Former continuation line has disappeared by becoming empty. */ 13144 /* Former continuation line has disappeared by becoming empty. */
13145 goto cancel; 13145 goto cancel;
13146 else if (XFASTINT (w->last_modified) < MODIFF 13146 else if (w->last_modified < MODIFF
13147 || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF 13147 || w->last_overlay_modified < OVERLAY_MODIFF
13148 || MINI_WINDOW_P (w)) 13148 || MINI_WINDOW_P (w))
13149 { 13149 {
13150 /* We have to handle the case of continuation around a 13150 /* We have to handle the case of continuation around a
@@ -13248,7 +13248,7 @@ redisplay_internal (void)
13248 goto cancel; 13248 goto cancel;
13249 } 13249 }
13250 else if (/* Cursor position hasn't changed. */ 13250 else if (/* Cursor position hasn't changed. */
13251 PT == XFASTINT (w->last_point) 13251 PT == w->last_point
13252 /* Make sure the cursor was last displayed 13252 /* Make sure the cursor was last displayed
13253 in this window. Otherwise we have to reposition it. */ 13253 in this window. Otherwise we have to reposition it. */
13254 && 0 <= w->cursor.vpos 13254 && 0 <= w->cursor.vpos
@@ -13664,10 +13664,8 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13664 { 13664 {
13665 struct buffer *b = XBUFFER (w->buffer); 13665 struct buffer *b = XBUFFER (w->buffer);
13666 13666
13667 w->last_modified 13667 w->last_modified = accurate_p ? BUF_MODIFF(b) : 0;
13668 = make_number (accurate_p ? BUF_MODIFF (b) : 0); 13668 w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0;
13669 w->last_overlay_modified
13670 = make_number (accurate_p ? BUF_OVERLAY_MODIFF (b) : 0);
13671 w->last_had_star 13669 w->last_had_star
13672 = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b); 13670 = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b);
13673 13671
@@ -13689,9 +13687,9 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13689 w->last_cursor_off_p = w->cursor_off_p; 13687 w->last_cursor_off_p = w->cursor_off_p;
13690 13688
13691 if (w == XWINDOW (selected_window)) 13689 if (w == XWINDOW (selected_window))
13692 w->last_point = make_number (BUF_PT (b)); 13690 w->last_point = BUF_PT (b);
13693 else 13691 else
13694 w->last_point = make_number (XMARKER (w->pointm)->charpos); 13692 w->last_point = XMARKER (w->pointm)->charpos;
13695 } 13693 }
13696 } 13694 }
13697 13695
@@ -14932,6 +14930,11 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14932 return rc; 14930 return rc;
14933#endif 14931#endif
14934 14932
14933 /* Previously, there was a check for Lisp integer in the
14934 if-statement below. Now, this field is converted to
14935 ptrdiff_t, thus zero means invalid position in a buffer. */
14936 eassert (w->last_point > 0);
14937
14935 /* Handle case where text has not changed, only point, and it has 14938 /* Handle case where text has not changed, only point, and it has
14936 not moved off the frame. */ 14939 not moved off the frame. */
14937 if (/* Point may be in this window. */ 14940 if (/* Point may be in this window. */
@@ -14952,8 +14955,6 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14952 && !NILP (BVAR (current_buffer, mark_active))) 14955 && !NILP (BVAR (current_buffer, mark_active)))
14953 && NILP (w->region_showing) 14956 && NILP (w->region_showing)
14954 && NILP (Vshow_trailing_whitespace) 14957 && NILP (Vshow_trailing_whitespace)
14955 /* Right after splitting windows, last_point may be nil. */
14956 && INTEGERP (w->last_point)
14957 /* This code is not used for mini-buffer for the sake of the case 14958 /* This code is not used for mini-buffer for the sake of the case
14958 of redisplaying to replace an echo area message; since in 14959 of redisplaying to replace an echo area message; since in
14959 that case the mini-buffer contents per se are usually 14960 that case the mini-buffer contents per se are usually
@@ -15011,7 +15012,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15011 int scroll_p = 0, must_scroll = 0; 15012 int scroll_p = 0, must_scroll = 0;
15012 int last_y = window_text_bottom_y (w) - this_scroll_margin; 15013 int last_y = window_text_bottom_y (w) - this_scroll_margin;
15013 15014
15014 if (PT > XFASTINT (w->last_point)) 15015 if (PT > w->last_point)
15015 { 15016 {
15016 /* Point has moved forward. */ 15017 /* Point has moved forward. */
15017 while (MATRIX_ROW_END_CHARPOS (row) < PT 15018 while (MATRIX_ROW_END_CHARPOS (row) < PT
@@ -15046,7 +15047,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15046 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) 15047 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
15047 scroll_p = 1; 15048 scroll_p = 1;
15048 } 15049 }
15049 else if (PT < XFASTINT (w->last_point)) 15050 else if (PT < w->last_point)
15050 { 15051 {
15051 /* Cursor has to be moved backward. Note that PT >= 15052 /* Cursor has to be moved backward. Note that PT >=
15052 CHARPOS (startp) because of the outer if-statement. */ 15053 CHARPOS (startp) because of the outer if-statement. */
@@ -15392,8 +15393,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15392 = (!NILP (w->window_end_valid) 15393 = (!NILP (w->window_end_valid)
15393 && !current_buffer->clip_changed 15394 && !current_buffer->clip_changed
15394 && !current_buffer->prevent_redisplay_optimizations_p 15395 && !current_buffer->prevent_redisplay_optimizations_p
15395 && XFASTINT (w->last_modified) >= MODIFF 15396 && w->last_modified >= MODIFF
15396 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF); 15397 && w->last_overlay_modified >= OVERLAY_MODIFF);
15397 15398
15398 /* Run the window-bottom-change-functions 15399 /* Run the window-bottom-change-functions
15399 if it is possible that the text on the screen has changed 15400 if it is possible that the text on the screen has changed
@@ -15415,8 +15416,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15415 buffer_unchanged_p 15416 buffer_unchanged_p
15416 = (!NILP (w->window_end_valid) 15417 = (!NILP (w->window_end_valid)
15417 && !current_buffer->clip_changed 15418 && !current_buffer->clip_changed
15418 && XFASTINT (w->last_modified) >= MODIFF 15419 && w->last_modified >= MODIFF
15419 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF); 15420 && w->last_overlay_modified >= OVERLAY_MODIFF);
15420 15421
15421 /* When windows_or_buffers_changed is non-zero, we can't rely on 15422 /* When windows_or_buffers_changed is non-zero, we can't rely on
15422 the window end being valid, so set it to nil there. */ 15423 the window end being valid, so set it to nil there. */
@@ -15441,9 +15442,9 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15441 if (!NILP (w->column_number_displayed) 15442 if (!NILP (w->column_number_displayed)
15442 /* This alternative quickly identifies a common case 15443 /* This alternative quickly identifies a common case
15443 where no change is needed. */ 15444 where no change is needed. */
15444 && !(PT == XFASTINT (w->last_point) 15445 && !(PT == w->last_point
15445 && XFASTINT (w->last_modified) >= MODIFF 15446 && w->last_modified >= MODIFF
15446 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF) 15447 && w->last_overlay_modified >= OVERLAY_MODIFF)
15447 && (XFASTINT (w->column_number_displayed) != current_column ())) 15448 && (XFASTINT (w->column_number_displayed) != current_column ()))
15448 update_mode_line = 1; 15449 update_mode_line = 1;
15449 15450
@@ -15559,8 +15560,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15559 startp = run_window_scroll_functions (window, startp); 15560 startp = run_window_scroll_functions (window, startp);
15560 } 15561 }
15561 15562
15562 w->last_modified = make_number (0); 15563 w->last_modified = 0;
15563 w->last_overlay_modified = make_number (0); 15564 w->last_overlay_modified = 0;
15564 if (CHARPOS (startp) < BEGV) 15565 if (CHARPOS (startp) < BEGV)
15565 SET_TEXT_POS (startp, BEGV, BEGV_BYTE); 15566 SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
15566 else if (CHARPOS (startp) > ZV) 15567 else if (CHARPOS (startp) > ZV)
@@ -15685,8 +15686,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15685 && (CHARPOS (startp) < ZV 15686 && (CHARPOS (startp) < ZV
15686 /* Avoid starting at end of buffer. */ 15687 /* Avoid starting at end of buffer. */
15687 || CHARPOS (startp) == BEGV 15688 || CHARPOS (startp) == BEGV
15688 || (XFASTINT (w->last_modified) >= MODIFF 15689 || (w->last_modified >= MODIFF
15689 && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF))) 15690 && w->last_overlay_modified >= OVERLAY_MODIFF)))
15690 { 15691 {
15691 int d1, d2, d3, d4, d5, d6; 15692 int d1, d2, d3, d4, d5, d6;
15692 15693
@@ -15773,8 +15774,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15773 15774
15774 try_to_scroll: 15775 try_to_scroll:
15775 15776
15776 w->last_modified = make_number (0); 15777 w->last_modified = 0;
15777 w->last_overlay_modified = make_number (0); 15778 w->last_overlay_modified = 0;
15778 15779
15779 /* Redisplay the mode line. Select the buffer properly for that. */ 15780 /* Redisplay the mode line. Select the buffer properly for that. */
15780 if (!update_mode_line) 15781 if (!update_mode_line)
@@ -17133,11 +17134,11 @@ try_window_id (struct window *w)
17133 GIVE_UP (5); 17134 GIVE_UP (5);
17134 17135
17135 /* Another way to prevent redisplay optimizations. */ 17136 /* Another way to prevent redisplay optimizations. */
17136 if (XFASTINT (w->last_modified) == 0) 17137 if (w->last_modified == 0)
17137 GIVE_UP (6); 17138 GIVE_UP (6);
17138 17139
17139 /* Verify that window is not hscrolled. */ 17140 /* Verify that window is not hscrolled. */
17140 if (XFASTINT (w->hscroll) != 0) 17141 if (w->hscroll != 0)
17141 GIVE_UP (7); 17142 GIVE_UP (7);
17142 17143
17143 /* Verify that display wasn't paused. */ 17144 /* Verify that display wasn't paused. */
@@ -27410,8 +27411,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
27410 b = XBUFFER (w->buffer); 27411 b = XBUFFER (w->buffer);
27411 if (part == ON_TEXT 27412 if (part == ON_TEXT
27412 && EQ (w->window_end_valid, w->buffer) 27413 && EQ (w->window_end_valid, w->buffer)
27413 && XFASTINT (w->last_modified) == BUF_MODIFF (b) 27414 && w->last_modified == BUF_MODIFF (b)
27414 && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) 27415 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b))
27415 { 27416 {
27416 int hpos, vpos, dx, dy, area = LAST_AREA; 27417 int hpos, vpos, dx, dy, area = LAST_AREA;
27417 ptrdiff_t pos; 27418 ptrdiff_t pos;