aboutsummaryrefslogtreecommitdiffstats
path: root/src/xdisp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xdisp.c')
-rw-r--r--src/xdisp.c122
1 files changed, 54 insertions, 68 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 880e25334d1..12efe3c5396 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2544,8 +2544,7 @@ check_it (struct it *it)
2544static void 2544static void
2545check_window_end (struct window *w) 2545check_window_end (struct window *w)
2546{ 2546{
2547 if (!MINI_WINDOW_P (w) 2547 if (!MINI_WINDOW_P (w) && w->window_end_valid)
2548 && !NILP (w->window_end_valid))
2549 { 2548 {
2550 struct glyph_row *row; 2549 struct glyph_row *row;
2551 eassert ((row = MATRIX_ROW (w->current_matrix, 2550 eassert ((row = MATRIX_ROW (w->current_matrix,
@@ -12976,10 +12975,10 @@ static void
12976reconsider_clip_changes (struct window *w, struct buffer *b) 12975reconsider_clip_changes (struct window *w, struct buffer *b)
12977{ 12976{
12978 if (b->clip_changed 12977 if (b->clip_changed
12979 && !NILP (w->window_end_valid) 12978 && w->window_end_valid
12980 && w->current_matrix->buffer == b 12979 && w->current_matrix->buffer == b
12981 && w->current_matrix->zv == BUF_ZV (b) 12980 && w->current_matrix->zv == BUF_ZV (b)
12982 && w->current_matrix->begv == BUF_BEGV (b)) 12981 && w->current_matrix->begv == BUF_BEGV (b))
12983 b->clip_changed = 0; 12982 b->clip_changed = 0;
12984 12983
12985 /* If display wasn't paused, and W is not a tool bar window, see if 12984 /* If display wasn't paused, and W is not a tool bar window, see if
@@ -12987,8 +12986,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
12987 we set b->clip_changed to 1 to force updating the screen. If 12986 we set b->clip_changed to 1 to force updating the screen. If
12988 b->clip_changed has already been set to 1, we can skip this 12987 b->clip_changed has already been set to 1, we can skip this
12989 check. */ 12988 check. */
12990 if (!b->clip_changed 12989 if (!b->clip_changed && BUFFERP (w->buffer) && w->window_end_valid)
12991 && BUFFERP (w->buffer) && !NILP (w->window_end_valid))
12992 { 12990 {
12993 ptrdiff_t pt; 12991 ptrdiff_t pt;
12994 12992
@@ -13382,7 +13380,7 @@ redisplay_internal (void)
13382 else if (XFASTINT (w->window_end_vpos) == this_line_vpos 13380 else if (XFASTINT (w->window_end_vpos) == this_line_vpos
13383 && this_line_vpos > 0) 13381 && this_line_vpos > 0)
13384 wset_window_end_vpos (w, make_number (this_line_vpos - 1)); 13382 wset_window_end_vpos (w, make_number (this_line_vpos - 1));
13385 wset_window_end_valid (w, Qnil); 13383 w->window_end_valid = 0;
13386 13384
13387 /* Update hint: No need to try to scroll in update_window. */ 13385 /* Update hint: No need to try to scroll in update_window. */
13388 w->desired_matrix->no_scrolling_p = 1; 13386 w->desired_matrix->no_scrolling_p = 1;
@@ -13783,50 +13781,43 @@ unwind_redisplay (Lisp_Object old_frame)
13783} 13781}
13784 13782
13785 13783
13786/* Mark the display of window W as accurate or inaccurate. If 13784/* Mark the display of leaf window W as accurate or inaccurate.
13787 ACCURATE_P is non-zero mark display of W as accurate. If 13785 If ACCURATE_P is non-zero mark display of W as accurate. If
13788 ACCURATE_P is zero, arrange for W to be redisplayed the next time 13786 ACCURATE_P is zero, arrange for W to be redisplayed the next
13789 redisplay_internal is called. */ 13787 time redisplay_internal is called. */
13790 13788
13791static void 13789static void
13792mark_window_display_accurate_1 (struct window *w, int accurate_p) 13790mark_window_display_accurate_1 (struct window *w, int accurate_p)
13793{ 13791{
13794 if (BUFFERP (w->buffer)) 13792 struct buffer *b = XBUFFER (w->buffer);
13795 {
13796 struct buffer *b = XBUFFER (w->buffer);
13797 13793
13798 w->last_modified = accurate_p ? BUF_MODIFF (b) : 0; 13794 w->last_modified = accurate_p ? BUF_MODIFF (b) : 0;
13799 w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0; 13795 w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0;
13800 w->last_had_star 13796 w->last_had_star = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b);
13801 = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b);
13802 13797
13803 if (accurate_p) 13798 if (accurate_p)
13804 { 13799 {
13805 b->clip_changed = 0; 13800 b->clip_changed = 0;
13806 b->prevent_redisplay_optimizations_p = 0; 13801 b->prevent_redisplay_optimizations_p = 0;
13807 13802
13808 BUF_UNCHANGED_MODIFIED (b) = BUF_MODIFF (b); 13803 BUF_UNCHANGED_MODIFIED (b) = BUF_MODIFF (b);
13809 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = BUF_OVERLAY_MODIFF (b); 13804 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = BUF_OVERLAY_MODIFF (b);
13810 BUF_BEG_UNCHANGED (b) = BUF_GPT (b) - BUF_BEG (b); 13805 BUF_BEG_UNCHANGED (b) = BUF_GPT (b) - BUF_BEG (b);
13811 BUF_END_UNCHANGED (b) = BUF_Z (b) - BUF_GPT (b); 13806 BUF_END_UNCHANGED (b) = BUF_Z (b) - BUF_GPT (b);
13812 13807
13813 w->current_matrix->buffer = b; 13808 w->current_matrix->buffer = b;
13814 w->current_matrix->begv = BUF_BEGV (b); 13809 w->current_matrix->begv = BUF_BEGV (b);
13815 w->current_matrix->zv = BUF_ZV (b); 13810 w->current_matrix->zv = BUF_ZV (b);
13816 13811
13817 w->last_cursor = w->cursor; 13812 w->last_cursor = w->cursor;
13818 w->last_cursor_off_p = w->cursor_off_p; 13813 w->last_cursor_off_p = w->cursor_off_p;
13819 13814
13820 if (w == XWINDOW (selected_window)) 13815 if (w == XWINDOW (selected_window))
13821 w->last_point = BUF_PT (b); 13816 w->last_point = BUF_PT (b);
13822 else 13817 else
13823 w->last_point = marker_position (w->pointm); 13818 w->last_point = marker_position (w->pointm);
13824 }
13825 }
13826 13819
13827 if (accurate_p) 13820 w->window_end_valid = 1;
13828 {
13829 wset_window_end_valid (w, w->buffer);
13830 w->update_mode_line = 0; 13821 w->update_mode_line = 0;
13831 } 13822 }
13832} 13823}
@@ -13845,25 +13836,21 @@ mark_window_display_accurate (Lisp_Object window, int accurate_p)
13845 for (; !NILP (window); window = w->next) 13836 for (; !NILP (window); window = w->next)
13846 { 13837 {
13847 w = XWINDOW (window); 13838 w = XWINDOW (window);
13848 mark_window_display_accurate_1 (w, accurate_p);
13849
13850 if (!NILP (w->vchild)) 13839 if (!NILP (w->vchild))
13851 mark_window_display_accurate (w->vchild, accurate_p); 13840 mark_window_display_accurate (w->vchild, accurate_p);
13852 if (!NILP (w->hchild)) 13841 else if (!NILP (w->hchild))
13853 mark_window_display_accurate (w->hchild, accurate_p); 13842 mark_window_display_accurate (w->hchild, accurate_p);
13843 else if (BUFFERP (w->buffer))
13844 mark_window_display_accurate_1 (w, accurate_p);
13854 } 13845 }
13855 13846
13856 if (accurate_p) 13847 if (accurate_p)
13857 { 13848 update_overlay_arrows (1);
13858 update_overlay_arrows (1);
13859 }
13860 else 13849 else
13861 { 13850 /* Force a thorough redisplay the next time by setting
13862 /* Force a thorough redisplay the next time by setting 13851 last_arrow_position and last_arrow_string to t, which is
13863 last_arrow_position and last_arrow_string to t, which is 13852 unequal to any useful value of Voverlay_arrow_... */
13864 unequal to any useful value of Voverlay_arrow_... */ 13853 update_overlay_arrows (-1);
13865 update_overlay_arrows (-1);
13866 }
13867} 13854}
13868 13855
13869 13856
@@ -15532,7 +15519,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15532 set_buffer_internal_1 (XBUFFER (w->buffer)); 15519 set_buffer_internal_1 (XBUFFER (w->buffer));
15533 15520
15534 current_matrix_up_to_date_p 15521 current_matrix_up_to_date_p
15535 = (!NILP (w->window_end_valid) 15522 = (w->window_end_valid
15536 && !current_buffer->clip_changed 15523 && !current_buffer->clip_changed
15537 && !current_buffer->prevent_redisplay_optimizations_p 15524 && !current_buffer->prevent_redisplay_optimizations_p
15538 && !window_outdated (w)); 15525 && !window_outdated (w));
@@ -15555,7 +15542,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15555 specbind (Qinhibit_point_motion_hooks, Qt); 15542 specbind (Qinhibit_point_motion_hooks, Qt);
15556 15543
15557 buffer_unchanged_p 15544 buffer_unchanged_p
15558 = (!NILP (w->window_end_valid) 15545 = (w->window_end_valid
15559 && !current_buffer->clip_changed 15546 && !current_buffer->clip_changed
15560 && !window_outdated (w)); 15547 && !window_outdated (w));
15561 15548
@@ -15568,7 +15555,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15568 if (XMARKER (w->start)->buffer == current_buffer) 15555 if (XMARKER (w->start)->buffer == current_buffer)
15569 compute_window_start_on_continuation_line (w); 15556 compute_window_start_on_continuation_line (w);
15570 15557
15571 wset_window_end_valid (w, Qnil); 15558 w->window_end_valid = 0;
15572 } 15559 }
15573 15560
15574 /* Some sanity checks. */ 15561 /* Some sanity checks. */
@@ -15657,7 +15644,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15657 15644
15658 w->force_start = 0; 15645 w->force_start = 0;
15659 w->vscroll = 0; 15646 w->vscroll = 0;
15660 wset_window_end_valid (w, Qnil); 15647 w->window_end_valid = 0;
15661 15648
15662 /* Forget any recorded base line for line number display. */ 15649 /* Forget any recorded base line for line number display. */
15663 if (!buffer_unchanged_p) 15650 if (!buffer_unchanged_p)
@@ -16106,8 +16093,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16106 line.) */ 16093 line.) */
16107 if (w->cursor.vpos < 0) 16094 if (w->cursor.vpos < 0)
16108 { 16095 {
16109 if (!NILP (w->window_end_valid) 16096 if (w->window_end_valid && PT >= Z - XFASTINT (w->window_end_pos))
16110 && PT >= Z - XFASTINT (w->window_end_pos))
16111 { 16097 {
16112 clear_glyph_matrix (w->desired_matrix); 16098 clear_glyph_matrix (w->desired_matrix);
16113 move_it_by_lines (&it, 1); 16099 move_it_by_lines (&it, 1);
@@ -16431,7 +16417,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16431 } 16417 }
16432 16418
16433 /* But that is not valid info until redisplay finishes. */ 16419 /* But that is not valid info until redisplay finishes. */
16434 wset_window_end_valid (w, Qnil); 16420 w->window_end_valid = 0;
16435 return 1; 16421 return 1;
16436} 16422}
16437 16423
@@ -16685,7 +16671,7 @@ try_window_reusing_current_matrix (struct window *w)
16685 wset_window_end_pos (w, make_number (Z - ZV)); 16671 wset_window_end_pos (w, make_number (Z - ZV));
16686 wset_window_end_vpos (w, make_number (0)); 16672 wset_window_end_vpos (w, make_number (0));
16687 } 16673 }
16688 wset_window_end_valid (w, Qnil); 16674 w->window_end_valid = 0;
16689 16675
16690 /* Update hint: don't try scrolling again in update_window. */ 16676 /* Update hint: don't try scrolling again in update_window. */
16691 w->desired_matrix->no_scrolling_p = 1; 16677 w->desired_matrix->no_scrolling_p = 1;
@@ -16883,7 +16869,7 @@ try_window_reusing_current_matrix (struct window *w)
16883 (w, make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled)); 16869 (w, make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled));
16884 } 16870 }
16885 16871
16886 wset_window_end_valid (w, Qnil); 16872 w->window_end_valid = 0;
16887 w->desired_matrix->no_scrolling_p = 1; 16873 w->desired_matrix->no_scrolling_p = 1;
16888 16874
16889#ifdef GLYPH_DEBUG 16875#ifdef GLYPH_DEBUG
@@ -17016,7 +17002,7 @@ find_first_unchanged_at_end_row (struct window *w,
17016 17002
17017 /* Display must not have been paused, otherwise the current matrix 17003 /* Display must not have been paused, otherwise the current matrix
17018 is not up to date. */ 17004 is not up to date. */
17019 eassert (!NILP (w->window_end_valid)); 17005 eassert (w->window_end_valid);
17020 17006
17021 /* A value of window_end_pos >= END_UNCHANGED means that the window 17007 /* A value of window_end_pos >= END_UNCHANGED means that the window
17022 end is in the range of changed text. If so, there is no 17008 end is in the range of changed text. If so, there is no
@@ -17200,7 +17186,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
17200 17186
17201/* Try to redisplay window W by reusing its existing display. W's 17187/* Try to redisplay window W by reusing its existing display. W's
17202 current matrix must be up to date when this function is called, 17188 current matrix must be up to date when this function is called,
17203 i.e. window_end_valid must not be nil. 17189 i.e. window_end_valid must be nonzero.
17204 17190
17205 Value is 17191 Value is
17206 17192
@@ -17315,7 +17301,7 @@ try_window_id (struct window *w)
17315 GIVE_UP (7); 17301 GIVE_UP (7);
17316 17302
17317 /* Verify that display wasn't paused. */ 17303 /* Verify that display wasn't paused. */
17318 if (NILP (w->window_end_valid)) 17304 if (!w->window_end_valid)
17319 GIVE_UP (8); 17305 GIVE_UP (8);
17320 17306
17321 /* Can't use this if highlighting a region because a cursor movement 17307 /* Can't use this if highlighting a region because a cursor movement
@@ -17966,7 +17952,7 @@ try_window_id (struct window *w)
17966 debug_end_vpos = XFASTINT (w->window_end_vpos)); 17952 debug_end_vpos = XFASTINT (w->window_end_vpos));
17967 17953
17968 /* Record that display has not been completed. */ 17954 /* Record that display has not been completed. */
17969 wset_window_end_valid (w, Qnil); 17955 w->window_end_valid = 0;
17970 w->desired_matrix->no_scrolling_p = 1; 17956 w->desired_matrix->no_scrolling_p = 1;
17971 return 3; 17957 return 3;
17972 17958
@@ -28045,7 +28031,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
28045 And verify the buffer's text has not changed. */ 28031 And verify the buffer's text has not changed. */
28046 b = XBUFFER (w->buffer); 28032 b = XBUFFER (w->buffer);
28047 if (part == ON_TEXT 28033 if (part == ON_TEXT
28048 && EQ (w->window_end_valid, w->buffer) 28034 && w->window_end_valid
28049 && w->last_modified == BUF_MODIFF (b) 28035 && w->last_modified == BUF_MODIFF (b)
28050 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b)) 28036 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b))
28051 { 28037 {