diff options
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 38 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e762eb13b87..8b7c1d9113d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-11-03 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (init_from_display_pos): Fix initialization of the bidi | ||
| 4 | iterator when starting in the middle of a display or overlay | ||
| 5 | string. (Bug#12745) | ||
| 6 | |||
| 1 | 2012-11-01 Eli Zaretskii <eliz@gnu.org> | 7 | 2012-11-01 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * w32proc.c (getpgrp, setpgid): New functions. (Bug#12776) | 9 | * w32proc.c (getpgrp, setpgid): New functions. (Bug#12776) |
diff --git a/src/xdisp.c b/src/xdisp.c index b3b08edcd0a..bc1cbd94bd5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -928,6 +928,7 @@ static enum move_it_result | |||
| 928 | move_it_in_display_line_to (struct it *, ptrdiff_t, int, | 928 | move_it_in_display_line_to (struct it *, ptrdiff_t, int, |
| 929 | enum move_operation_enum); | 929 | enum move_operation_enum); |
| 930 | void move_it_vertically_backward (struct it *, int); | 930 | void move_it_vertically_backward (struct it *, int); |
| 931 | static void get_visually_first_element (struct it *); | ||
| 931 | static void init_to_row_start (struct it *, struct window *, | 932 | static void init_to_row_start (struct it *, struct window *, |
| 932 | struct glyph_row *); | 933 | struct glyph_row *); |
| 933 | static int init_to_row_end (struct it *, struct window *, | 934 | static int init_to_row_end (struct it *, struct window *, |
| @@ -3113,6 +3114,40 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) | |||
| 3113 | eassert (STRINGP (it->string)); | 3114 | eassert (STRINGP (it->string)); |
| 3114 | it->current.string_pos = pos->string_pos; | 3115 | it->current.string_pos = pos->string_pos; |
| 3115 | it->method = GET_FROM_STRING; | 3116 | it->method = GET_FROM_STRING; |
| 3117 | it->end_charpos = SCHARS (it->string); | ||
| 3118 | /* Set up the bidi iterator for this overlay string. */ | ||
| 3119 | if (it->bidi_p) | ||
| 3120 | { | ||
| 3121 | it->bidi_it.string.lstring = it->string; | ||
| 3122 | it->bidi_it.string.s = NULL; | ||
| 3123 | it->bidi_it.string.schars = SCHARS (it->string); | ||
| 3124 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; | ||
| 3125 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | ||
| 3126 | it->bidi_it.string.unibyte = !it->multibyte_p; | ||
| 3127 | bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), | ||
| 3128 | FRAME_WINDOW_P (it->f), &it->bidi_it); | ||
| 3129 | |||
| 3130 | /* Synchronize the state of the bidi iterator with | ||
| 3131 | pos->string_pos. For any string position other than | ||
| 3132 | zero, this will be done automagically when we resume | ||
| 3133 | iteration over the string and get_visually_first_element | ||
| 3134 | is called. But if string_pos is zero, and the string is | ||
| 3135 | to be reordered for display, we need to resync manually, | ||
| 3136 | since it could be that the iteration state recorded in | ||
| 3137 | pos ended at string_pos of 0 moving backwards in string. */ | ||
| 3138 | if (CHARPOS (pos->string_pos) == 0) | ||
| 3139 | { | ||
| 3140 | get_visually_first_element (it); | ||
| 3141 | if (IT_STRING_CHARPOS (*it) != 0) | ||
| 3142 | do { | ||
| 3143 | /* Paranoia. */ | ||
| 3144 | eassert (it->bidi_it.charpos < it->bidi_it.string.schars); | ||
| 3145 | bidi_move_to_visually_next (&it->bidi_it); | ||
| 3146 | } while (it->bidi_it.charpos != 0); | ||
| 3147 | } | ||
| 3148 | eassert (IT_STRING_CHARPOS (*it) == it->bidi_it.charpos | ||
| 3149 | && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos); | ||
| 3150 | } | ||
| 3116 | } | 3151 | } |
| 3117 | 3152 | ||
| 3118 | if (CHARPOS (pos->string_pos) >= 0) | 3153 | if (CHARPOS (pos->string_pos) >= 0) |
| @@ -3122,6 +3157,9 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) | |||
| 3122 | IT should already be filled with that string. */ | 3157 | IT should already be filled with that string. */ |
| 3123 | it->current.string_pos = pos->string_pos; | 3158 | it->current.string_pos = pos->string_pos; |
| 3124 | eassert (STRINGP (it->string)); | 3159 | eassert (STRINGP (it->string)); |
| 3160 | if (it->bidi_p) | ||
| 3161 | bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), | ||
| 3162 | FRAME_WINDOW_P (it->f), &it->bidi_it); | ||
| 3125 | } | 3163 | } |
| 3126 | 3164 | ||
| 3127 | /* Restore position in display vector translations, control | 3165 | /* Restore position in display vector translations, control |