diff options
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/bidi.c | 14 | ||||
| -rw-r--r-- | src/dispextern.h | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 27 |
4 files changed, 54 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 629f90678e6..cf5a8c0ee1e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2013-06-08 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * bidi.c (bidi_fetch_char): Accept additional argument, the window | ||
| 4 | being displayed, and pass it to compute_display_string_pos. | ||
| 5 | (bidi_level_of_next_char, bidi_resolve_explicit_1) | ||
| 6 | (bidi_paragraph_init): All callers changed. | ||
| 7 | |||
| 8 | * xdisp.c (init_from_display_pos, init_iterator) | ||
| 9 | (handle_single_display_spec, next_overlay_string) | ||
| 10 | (get_overlay_strings_1, reseat_1, reseat_to_string) | ||
| 11 | (push_prefix_prop, Fcurrent_bidi_paragraph_direction): Set | ||
| 12 | bidi_it.w member from it->w. | ||
| 13 | (compute_display_string_pos): Accept additional argument, the | ||
| 14 | window being displayed, and pass it to Fget_char_property. | ||
| 15 | (Bug#14575) | ||
| 16 | |||
| 17 | * dispextern.h (struct bidi_it): New member w, the window being | ||
| 18 | displayed. | ||
| 19 | (compute_display_string_pos): Adjust prototype. | ||
| 20 | |||
| 1 | 2013-06-08 Jan Djärv <jan.h.d@swipnet.se> | 21 | 2013-06-08 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 22 | ||
| 3 | * xgselect.c: Remove unneeded include xterm.h | 23 | * xgselect.c: Remove unneeded include xterm.h |
diff --git a/src/bidi.c b/src/bidi.c index c6bea62f67b..c31d208ecbc 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -927,6 +927,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte) | |||
| 927 | static int | 927 | static int |
| 928 | bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | 928 | bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, |
| 929 | int *disp_prop, struct bidi_string_data *string, | 929 | int *disp_prop, struct bidi_string_data *string, |
| 930 | struct window *w, | ||
| 930 | bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) | 931 | bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) |
| 931 | { | 932 | { |
| 932 | int ch; | 933 | int ch; |
| @@ -940,7 +941,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | |||
| 940 | if (charpos < endpos && charpos > *disp_pos) | 941 | if (charpos < endpos && charpos > *disp_pos) |
| 941 | { | 942 | { |
| 942 | SET_TEXT_POS (pos, charpos, bytepos); | 943 | SET_TEXT_POS (pos, charpos, bytepos); |
| 943 | *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, | 944 | *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, |
| 944 | disp_prop); | 945 | disp_prop); |
| 945 | } | 946 | } |
| 946 | 947 | ||
| @@ -1045,7 +1046,7 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | |||
| 1045 | && *disp_prop) | 1046 | && *disp_prop) |
| 1046 | { | 1047 | { |
| 1047 | SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); | 1048 | SET_TEXT_POS (pos, charpos + *nchars, bytepos + *ch_len); |
| 1048 | *disp_pos = compute_display_string_pos (&pos, string, frame_window_p, | 1049 | *disp_pos = compute_display_string_pos (&pos, string, w, frame_window_p, |
| 1049 | disp_prop); | 1050 | disp_prop); |
| 1050 | } | 1051 | } |
| 1051 | 1052 | ||
| @@ -1224,7 +1225,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1224 | if (!string_p) | 1225 | if (!string_p) |
| 1225 | pos = BYTE_TO_CHAR (bytepos); | 1226 | pos = BYTE_TO_CHAR (bytepos); |
| 1226 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, | 1227 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, &disp_prop, |
| 1227 | &bidi_it->string, | 1228 | &bidi_it->string, bidi_it->w, |
| 1228 | bidi_it->frame_window_p, &ch_len, &nchars); | 1229 | bidi_it->frame_window_p, &ch_len, &nchars); |
| 1229 | type = bidi_get_type (ch, NEUTRAL_DIR); | 1230 | type = bidi_get_type (ch, NEUTRAL_DIR); |
| 1230 | 1231 | ||
| @@ -1252,7 +1253,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) | |||
| 1252 | break; | 1253 | break; |
| 1253 | /* Fetch next character and advance to get past it. */ | 1254 | /* Fetch next character and advance to get past it. */ |
| 1254 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, | 1255 | ch = bidi_fetch_char (pos, bytepos, &disp_pos, |
| 1255 | &disp_prop, &bidi_it->string, | 1256 | &disp_prop, &bidi_it->string, bidi_it->w, |
| 1256 | bidi_it->frame_window_p, &ch_len, &nchars); | 1257 | bidi_it->frame_window_p, &ch_len, &nchars); |
| 1257 | pos += nchars; | 1258 | pos += nchars; |
| 1258 | bytepos += ch_len; | 1259 | bytepos += ch_len; |
| @@ -1402,7 +1403,8 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) | |||
| 1402 | a single character u+FFFC. */ | 1403 | a single character u+FFFC. */ |
| 1403 | curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, | 1404 | curchar = bidi_fetch_char (bidi_it->charpos, bidi_it->bytepos, |
| 1404 | &bidi_it->disp_pos, &bidi_it->disp_prop, | 1405 | &bidi_it->disp_pos, &bidi_it->disp_prop, |
| 1405 | &bidi_it->string, bidi_it->frame_window_p, | 1406 | &bidi_it->string, bidi_it->w, |
| 1407 | bidi_it->frame_window_p, | ||
| 1406 | &bidi_it->ch_len, &bidi_it->nchars); | 1408 | &bidi_it->ch_len, &bidi_it->nchars); |
| 1407 | } | 1409 | } |
| 1408 | bidi_it->ch = curchar; | 1410 | bidi_it->ch = curchar; |
| @@ -2194,7 +2196,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 2194 | emacs_abort (); | 2196 | emacs_abort (); |
| 2195 | do { | 2197 | do { |
| 2196 | ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, | 2198 | ch = bidi_fetch_char (cpos += nc, bpos += clen, &disp_pos, &dpp, &bs, |
| 2197 | fwp, &clen, &nc); | 2199 | bidi_it->w, fwp, &clen, &nc); |
| 2198 | if (ch == '\n' || ch == BIDI_EOB) | 2200 | if (ch == '\n' || ch == BIDI_EOB) |
| 2199 | chtype = NEUTRAL_B; | 2201 | chtype = NEUTRAL_B; |
| 2200 | else | 2202 | else |
diff --git a/src/dispextern.h b/src/dispextern.h index 50a32ffaf8f..83e8792dfe0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1881,6 +1881,7 @@ struct bidi_it { | |||
| 1881 | stuff that is not part of the bidi iterator's state! */ | 1881 | stuff that is not part of the bidi iterator's state! */ |
| 1882 | struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ | 1882 | struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ |
| 1883 | struct bidi_string_data string; /* string to reorder */ | 1883 | struct bidi_string_data string; /* string to reorder */ |
| 1884 | struct window *w; /* the window being displayed */ | ||
| 1884 | bidi_dir_t paragraph_dir; /* current paragraph direction */ | 1885 | bidi_dir_t paragraph_dir; /* current paragraph direction */ |
| 1885 | ptrdiff_t separator_limit; /* where paragraph separator should end */ | 1886 | ptrdiff_t separator_limit; /* where paragraph separator should end */ |
| 1886 | unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */ | 1887 | unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */ |
| @@ -3077,7 +3078,7 @@ extern void reseat_at_previous_visible_line_start (struct it *); | |||
| 3077 | extern Lisp_Object lookup_glyphless_char_display (int, struct it *); | 3078 | extern Lisp_Object lookup_glyphless_char_display (int, struct it *); |
| 3078 | extern ptrdiff_t compute_display_string_pos (struct text_pos *, | 3079 | extern ptrdiff_t compute_display_string_pos (struct text_pos *, |
| 3079 | struct bidi_string_data *, | 3080 | struct bidi_string_data *, |
| 3080 | int, int *); | 3081 | struct window *, int, int *); |
| 3081 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, | 3082 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, |
| 3082 | struct bidi_string_data *); | 3083 | struct bidi_string_data *); |
| 3083 | extern void produce_stretch_glyph (struct it *); | 3084 | extern void produce_stretch_glyph (struct it *); |
diff --git a/src/xdisp.c b/src/xdisp.c index 6e391350816..5ec72407191 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2650,6 +2650,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2650 | it->bidi_it.string.lstring = Qnil; | 2650 | it->bidi_it.string.lstring = Qnil; |
| 2651 | it->bidi_it.string.s = NULL; | 2651 | it->bidi_it.string.s = NULL; |
| 2652 | it->bidi_it.string.bufpos = 0; | 2652 | it->bidi_it.string.bufpos = 0; |
| 2653 | it->bidi_it.w = w; | ||
| 2653 | 2654 | ||
| 2654 | /* The window in which we iterate over current_buffer: */ | 2655 | /* The window in which we iterate over current_buffer: */ |
| 2655 | XSETWINDOW (it->window, w); | 2656 | XSETWINDOW (it->window, w); |
| @@ -3124,6 +3125,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) | |||
| 3124 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; | 3125 | 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.from_disp_str = it->string_from_display_prop_p; |
| 3126 | it->bidi_it.string.unibyte = !it->multibyte_p; | 3127 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 3128 | it->bidi_it.w = it->w; | ||
| 3127 | bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), | 3129 | bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it), |
| 3128 | FRAME_WINDOW_P (it->f), &it->bidi_it); | 3130 | FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 3129 | 3131 | ||
| @@ -3490,11 +3492,11 @@ next_overlay_change (ptrdiff_t pos) | |||
| 3490 | ptrdiff_t | 3492 | ptrdiff_t |
| 3491 | compute_display_string_pos (struct text_pos *position, | 3493 | compute_display_string_pos (struct text_pos *position, |
| 3492 | struct bidi_string_data *string, | 3494 | struct bidi_string_data *string, |
| 3495 | struct window *w, | ||
| 3493 | int frame_window_p, int *disp_prop) | 3496 | int frame_window_p, int *disp_prop) |
| 3494 | { | 3497 | { |
| 3495 | /* OBJECT = nil means current buffer. */ | 3498 | /* OBJECT = nil means current buffer. */ |
| 3496 | Lisp_Object object = | 3499 | Lisp_Object object, object1; |
| 3497 | (string && STRINGP (string->lstring)) ? string->lstring : Qnil; | ||
| 3498 | Lisp_Object pos, spec, limpos; | 3500 | Lisp_Object pos, spec, limpos; |
| 3499 | int string_p = (string && (STRINGP (string->lstring) || string->s)); | 3501 | int string_p = (string && (STRINGP (string->lstring) || string->s)); |
| 3500 | ptrdiff_t eob = string_p ? string->schars : ZV; | 3502 | ptrdiff_t eob = string_p ? string->schars : ZV; |
| @@ -3505,6 +3507,17 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3505 | struct text_pos tpos; | 3507 | struct text_pos tpos; |
| 3506 | int rv = 0; | 3508 | int rv = 0; |
| 3507 | 3509 | ||
| 3510 | if (string && STRINGP (string->lstring)) | ||
| 3511 | object1 = object = string->lstring; | ||
| 3512 | else if (!string_p) | ||
| 3513 | { | ||
| 3514 | eassert (w != NULL); | ||
| 3515 | XSETWINDOW (object, w); | ||
| 3516 | object1 = Qnil; | ||
| 3517 | } | ||
| 3518 | else | ||
| 3519 | object1 = object = Qnil; | ||
| 3520 | |||
| 3508 | *disp_prop = 1; | 3521 | *disp_prop = 1; |
| 3509 | 3522 | ||
| 3510 | if (charpos >= eob | 3523 | if (charpos >= eob |
| @@ -3543,7 +3556,7 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3543 | that will replace the underlying text when displayed. */ | 3556 | that will replace the underlying text when displayed. */ |
| 3544 | limpos = make_number (lim); | 3557 | limpos = make_number (lim); |
| 3545 | do { | 3558 | do { |
| 3546 | pos = Fnext_single_char_property_change (pos, Qdisplay, object, limpos); | 3559 | pos = Fnext_single_char_property_change (pos, Qdisplay, object1, limpos); |
| 3547 | CHARPOS (tpos) = XFASTINT (pos); | 3560 | CHARPOS (tpos) = XFASTINT (pos); |
| 3548 | if (CHARPOS (tpos) >= lim) | 3561 | if (CHARPOS (tpos) >= lim) |
| 3549 | { | 3562 | { |
| @@ -5031,6 +5044,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 5031 | it->bidi_it.string.bufpos = bufpos; | 5044 | it->bidi_it.string.bufpos = bufpos; |
| 5032 | it->bidi_it.string.from_disp_str = 1; | 5045 | it->bidi_it.string.from_disp_str = 1; |
| 5033 | it->bidi_it.string.unibyte = !it->multibyte_p; | 5046 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 5047 | it->bidi_it.w = it->w; | ||
| 5034 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 5048 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 5035 | } | 5049 | } |
| 5036 | } | 5050 | } |
| @@ -5409,6 +5423,7 @@ next_overlay_string (struct it *it) | |||
| 5409 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; | 5423 | it->bidi_it.string.bufpos = it->overlay_strings_charpos; |
| 5410 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 5424 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 5411 | it->bidi_it.string.unibyte = !it->multibyte_p; | 5425 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 5426 | it->bidi_it.w = it->w; | ||
| 5412 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 5427 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 5413 | } | 5428 | } |
| 5414 | } | 5429 | } |
| @@ -5712,6 +5727,7 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p) | |||
| 5712 | it->bidi_it.string.bufpos = pos; | 5727 | it->bidi_it.string.bufpos = pos; |
| 5713 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 5728 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 5714 | it->bidi_it.string.unibyte = !it->multibyte_p; | 5729 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 5730 | it->bidi_it.w = it->w; | ||
| 5715 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 5731 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 5716 | } | 5732 | } |
| 5717 | return 1; | 5733 | return 1; |
| @@ -6344,6 +6360,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) | |||
| 6344 | it->bidi_it.string.lstring = Qnil; | 6360 | it->bidi_it.string.lstring = Qnil; |
| 6345 | it->bidi_it.string.bufpos = 0; | 6361 | it->bidi_it.string.bufpos = 0; |
| 6346 | it->bidi_it.string.unibyte = 0; | 6362 | it->bidi_it.string.unibyte = 0; |
| 6363 | it->bidi_it.w = it->w; | ||
| 6347 | } | 6364 | } |
| 6348 | 6365 | ||
| 6349 | if (set_stop_p) | 6366 | if (set_stop_p) |
| @@ -6421,6 +6438,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, | |||
| 6421 | it->bidi_it.string.bufpos = 0; | 6438 | it->bidi_it.string.bufpos = 0; |
| 6422 | it->bidi_it.string.from_disp_str = 0; | 6439 | it->bidi_it.string.from_disp_str = 0; |
| 6423 | it->bidi_it.string.unibyte = !it->multibyte_p; | 6440 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 6441 | it->bidi_it.w = it->w; | ||
| 6424 | bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), | 6442 | bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), |
| 6425 | FRAME_WINDOW_P (it->f), &it->bidi_it); | 6443 | FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 6426 | } | 6444 | } |
| @@ -6452,6 +6470,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, | |||
| 6452 | it->bidi_it.string.bufpos = 0; | 6470 | it->bidi_it.string.bufpos = 0; |
| 6453 | it->bidi_it.string.from_disp_str = 0; | 6471 | it->bidi_it.string.from_disp_str = 0; |
| 6454 | it->bidi_it.string.unibyte = !it->multibyte_p; | 6472 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 6473 | it->bidi_it.w = it->w; | ||
| 6455 | bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), | 6474 | bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), |
| 6456 | &it->bidi_it); | 6475 | &it->bidi_it); |
| 6457 | } | 6476 | } |
| @@ -18921,6 +18940,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop) | |||
| 18921 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); | 18940 | it->bidi_it.string.bufpos = IT_CHARPOS (*it); |
| 18922 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; | 18941 | it->bidi_it.string.from_disp_str = it->string_from_display_prop_p; |
| 18923 | it->bidi_it.string.unibyte = !it->multibyte_p; | 18942 | it->bidi_it.string.unibyte = !it->multibyte_p; |
| 18943 | it->bidi_it.w = it->w; | ||
| 18924 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); | 18944 | bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); |
| 18925 | } | 18945 | } |
| 18926 | } | 18946 | } |
| @@ -19990,6 +20010,7 @@ See also `bidi-paragraph-direction'. */) | |||
| 19990 | itb.string.lstring = Qnil; | 20010 | itb.string.lstring = Qnil; |
| 19991 | itb.string.bufpos = 0; | 20011 | itb.string.bufpos = 0; |
| 19992 | itb.string.unibyte = 0; | 20012 | itb.string.unibyte = 0; |
| 20013 | itb.w = XWINDOW (selected_window); | ||
| 19993 | bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); | 20014 | bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); |
| 19994 | bidi_unshelve_cache (itb_data, 0); | 20015 | bidi_unshelve_cache (itb_data, 0); |
| 19995 | set_buffer_temp (old); | 20016 | set_buffer_temp (old); |