diff options
| author | Eli Zaretskii | 2010-01-09 11:24:37 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2010-01-09 11:24:37 -0500 |
| commit | 8d6a842ab025fecc9fab5665a7ac846957d0b739 (patch) | |
| tree | 90c978f999bde4a402f6abd02edde54d425ecc06 /src | |
| parent | 6eca625b774a4bdc782e8b878c8cf05663742101 (diff) | |
| download | emacs-8d6a842ab025fecc9fab5665a7ac846957d0b739.tar.gz emacs-8d6a842ab025fecc9fab5665a7ac846957d0b739.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog.bidi | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 28 |
2 files changed, 33 insertions, 2 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index 11ed09b6d54..08c51d2ee98 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2010-01-09 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (handle_stop_backwards): Add a prototype. | ||
| 4 | (reseat): call handle_stop_backwards to recompute prev_stop and | ||
| 5 | base_level_stop for the new position. Solves the crash when | ||
| 6 | scrolling backwards. | ||
| 7 | |||
| 1 | 2010-01-02 Eli Zaretskii <eliz@gnu.org> | 8 | 2010-01-02 Eli Zaretskii <eliz@gnu.org> |
| 2 | 9 | ||
| 3 | * .gdbinit (pitx): Display some bidi information about the | 10 | * .gdbinit (pitx): Display some bidi information about the |
diff --git a/src/xdisp.c b/src/xdisp.c index 7a6d634aa39..339df654dae 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -905,6 +905,7 @@ 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)); |
| @@ -5527,7 +5528,30 @@ reseat (it, pos, force_p) | |||
| 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 | } |
| @@ -6711,7 +6735,7 @@ next_element_from_buffer (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); |