comparison src/xdisp.c @ 107615:937f2da537a4

Recompute prev_stop and base_level_stop when the iterator is repositioned to a different location. xdisp.c (handle_stop_backwards): Add a prototype. (reseat): call handle_stop_backwards to recompute prev_stop and base_level_stop for the new position. Solves the crash when scrolling backwards.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 09 Jan 2010 11:24:37 -0500
parents 0dc1757dc6b9
children c5f9e4613394
comparison
equal deleted inserted replaced
107614:0dc1757dc6b9 107615:937f2da537a4
903 static int text_outside_line_unchanged_p P_ ((struct window *, int, int)); 903 static int text_outside_line_unchanged_p P_ ((struct window *, int, int));
904 static void store_mode_line_noprop_char P_ ((char)); 904 static void store_mode_line_noprop_char P_ ((char));
905 static int store_mode_line_noprop P_ ((const unsigned char *, int, int)); 905 static int store_mode_line_noprop P_ ((const unsigned char *, int, int));
906 static void x_consider_frame_title P_ ((Lisp_Object)); 906 static void x_consider_frame_title P_ ((Lisp_Object));
907 static void handle_stop P_ ((struct it *)); 907 static void handle_stop P_ ((struct it *));
908 static void handle_stop_backwards P_ ((struct it *, EMACS_INT));
908 static int tool_bar_lines_needed P_ ((struct frame *, int *)); 909 static int tool_bar_lines_needed P_ ((struct frame *, int *));
909 static int single_display_spec_intangible_p P_ ((Lisp_Object)); 910 static int single_display_spec_intangible_p P_ ((Lisp_Object));
910 static void ensure_echo_area_buffers P_ ((void)); 911 static void ensure_echo_area_buffers P_ ((void));
911 static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); 912 static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object));
912 static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); 913 static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *));
5525 /* Determine where to check text properties. Avoid doing it 5526 /* Determine where to check text properties. Avoid doing it
5526 where possible because text property lookup is very expensive. */ 5527 where possible because text property lookup is very expensive. */
5527 if (force_p 5528 if (force_p
5528 || CHARPOS (pos) > it->stop_charpos 5529 || CHARPOS (pos) > it->stop_charpos
5529 || CHARPOS (pos) < original_pos) 5530 || CHARPOS (pos) < original_pos)
5530 handle_stop (it); 5531 {
5532 if (it->bidi_p)
5533 {
5534 /* For bidi iteration, we need to prime prev_stop and
5535 base_level_stop with our best estimations. */
5536 if (CHARPOS (pos) < it->prev_stop)
5537 {
5538 handle_stop_backwards (it, BEGV);
5539 if (CHARPOS (pos) < it->base_level_stop)
5540 it->base_level_stop = 0;
5541 }
5542 else if (CHARPOS (pos) > it->stop_charpos
5543 && it->stop_charpos >= BEGV)
5544 handle_stop_backwards (it, it->stop_charpos);
5545 else /* force_p */
5546 handle_stop (it);
5547 }
5548 else
5549 {
5550 handle_stop (it);
5551 it->prev_stop = it->base_level_stop = 0;
5552 }
5553
5554 }
5531 5555
5532 CHECK_IT (it); 5556 CHECK_IT (it);
5533 } 5557 }
5534 5558
5535 5559
6709 embedding level, so test for that explicitly. */ 6733 embedding level, so test for that explicitly. */
6710 && !BIDI_AT_BASE_LEVEL (it->bidi_it) 6734 && !BIDI_AT_BASE_LEVEL (it->bidi_it)
6711 && IT_CHARPOS (*it) < it->prev_stop) 6735 && IT_CHARPOS (*it) < it->prev_stop)
6712 { 6736 {
6713 if (it->base_level_stop <= 0) 6737 if (it->base_level_stop <= 0)
6714 it->base_level_stop = 1; 6738 it->base_level_stop = BEGV;
6715 if (IT_CHARPOS (*it) < it->base_level_stop) 6739 if (IT_CHARPOS (*it) < it->base_level_stop)
6716 abort (); 6740 abort ();
6717 handle_stop_backwards (it, it->base_level_stop); 6741 handle_stop_backwards (it, it->base_level_stop);
6718 return GET_NEXT_DISPLAY_ELEMENT (it); 6742 return GET_NEXT_DISPLAY_ELEMENT (it);
6719 } 6743 }