diff options
| author | Joakim Verona | 2011-09-29 00:01:51 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-09-29 00:01:51 +0200 |
| commit | 7a982f9eef56799ebe5857f7b8b3e636c6715090 (patch) | |
| tree | 8014baca5849ccb340771eadf87b89d4cde00a64 /src | |
| parent | f0f8db4c04d0d3bdfa645cd79a9b7a915587a7c5 (diff) | |
| parent | 88d9610cae8004cf9856be84d76c389e7fc3b14b (diff) | |
| download | emacs-7a982f9eef56799ebe5857f7b8b3e636c6715090.tar.gz emacs-7a982f9eef56799ebe5857f7b8b3e636c6715090.zip | |
upstream
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 21 | ||||
| -rw-r--r-- | src/ChangeLog.11 | 2 | ||||
| -rw-r--r-- | src/ChangeLog.9 | 2 | ||||
| -rw-r--r-- | src/bidi.c | 10 | ||||
| -rw-r--r-- | src/lread.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 122 |
6 files changed, 120 insertions, 39 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 59169bdcf9f..f26754d1135 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2011-09-28 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (compute_display_string_end): If there's no display | ||
| 4 | string at CHARPOS, return -1. | ||
| 5 | |||
| 6 | * bidi.c (bidi_fetch_char): When compute_display_string_end | ||
| 7 | returns a negative value, treat the character as a normal | ||
| 8 | character not covered by a display string. (Bug#9624) | ||
| 9 | |||
| 10 | 2011-09-28 Juanma Barranquero <lekktu@gmail.com> | ||
| 11 | |||
| 12 | * lread.c (Fread_from_string): Fix typo in docstring. | ||
| 13 | |||
| 14 | 2011-09-27 Eli Zaretskii <eliz@gnu.org> | ||
| 15 | |||
| 16 | * xdisp.c (handle_invisible_prop): If invisible text ends on a | ||
| 17 | newline, reseat the iterator instead of bidi-iterating there one | ||
| 18 | character at a time. (Bug#9610) | ||
| 19 | (BUFFER_POS_REACHED_P, move_it_in_display_line_to): Bail when past | ||
| 20 | TO_CHARPOS if the bidi iterator is at base embedding level. | ||
| 21 | |||
| 1 | 2011-09-27 Andreas Schwab <schwab@linux-m68k.org> | 22 | 2011-09-27 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 23 | ||
| 3 | * lread.c (readevalloop): Use correct code for NBSP. | 24 | * lread.c (readevalloop): Use correct code for NBSP. |
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11 index b64736459c8..0a9df7d1aee 100644 --- a/src/ChangeLog.11 +++ b/src/ChangeLog.11 | |||
| @@ -4547,7 +4547,7 @@ | |||
| 4547 | 4547 | ||
| 4548 | * composite.c (composition_compute_stop_pos): In forward search, | 4548 | * composite.c (composition_compute_stop_pos): In forward search, |
| 4549 | pay attention to the possibility that some character after ENDPOS | 4549 | pay attention to the possibility that some character after ENDPOS |
| 4550 | will be composed with charactrs before ENDPOS. | 4550 | will be composed with characters before ENDPOS. |
| 4551 | 4551 | ||
| 4552 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> | 4552 | 2010-08-24 Chong Yidong <cyd@stupidchicken.com> |
| 4553 | 4553 | ||
diff --git a/src/ChangeLog.9 b/src/ChangeLog.9 index f25434087c1..ceec5da3296 100644 --- a/src/ChangeLog.9 +++ b/src/ChangeLog.9 | |||
| @@ -10460,7 +10460,7 @@ | |||
| 10460 | (Fkey_description): Likewise. | 10460 | (Fkey_description): Likewise. |
| 10461 | 10461 | ||
| 10462 | * lread.c (read1): On reading multibyte string, be sure to make | 10462 | * lread.c (read1): On reading multibyte string, be sure to make |
| 10463 | all 8-bit chararacters in valid multibyte form. | 10463 | all 8-bit characters in valid multibyte form. |
| 10464 | (readchar): Use FETCH_STRING_CHAR_ADVANCE unconditionally. | 10464 | (readchar): Use FETCH_STRING_CHAR_ADVANCE unconditionally. |
| 10465 | 10465 | ||
| 10466 | * print.c (print_object): Use FETCH_STRING_CHAR_ADVANCE | 10466 | * print.c (print_object): Use FETCH_STRING_CHAR_ADVANCE |
diff --git a/src/bidi.c b/src/bidi.c index 599c00449b5..e3fc03f4a9b 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -974,6 +974,15 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 974 | ch = 0xFFFC; | 974 | ch = 0xFFFC; |
| 975 | } | 975 | } |
| 976 | disp_end_pos = compute_display_string_end (*disp_pos, string); | 976 | disp_end_pos = compute_display_string_end (*disp_pos, string); |
| 977 | if (disp_end_pos < 0) | ||
| 978 | { | ||
| 979 | /* Somebody removed the display string from the buffer | ||
| 980 | behind our back. Recover by processing this buffer | ||
| 981 | position as if no display property were present there to | ||
| 982 | begin with. */ | ||
| 983 | *disp_prop = 0; | ||
| 984 | goto normal_char; | ||
| 985 | } | ||
| 977 | *nchars = disp_end_pos - *disp_pos; | 986 | *nchars = disp_end_pos - *disp_pos; |
| 978 | if (*nchars <= 0) | 987 | if (*nchars <= 0) |
| 979 | abort (); | 988 | abort (); |
| @@ -988,6 +997,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 988 | } | 997 | } |
| 989 | else | 998 | else |
| 990 | { | 999 | { |
| 1000 | normal_char: | ||
| 991 | if (string->s) | 1001 | if (string->s) |
| 992 | { | 1002 | { |
| 993 | int len; | 1003 | int len; |
diff --git a/src/lread.c b/src/lread.c index 241b1e41c94..af737d27070 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1966,7 +1966,7 @@ DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0, | |||
| 1966 | doc: /* Read one Lisp expression which is represented as text by STRING. | 1966 | doc: /* Read one Lisp expression which is represented as text by STRING. |
| 1967 | Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). | 1967 | Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). |
| 1968 | FINAL-STRING-INDEX is an integer giving the position of the next | 1968 | FINAL-STRING-INDEX is an integer giving the position of the next |
| 1969 | remaining chararacter in STRING. | 1969 | remaining character in STRING. |
| 1970 | START and END optionally delimit a substring of STRING from which to read; | 1970 | START and END optionally delimit a substring of STRING from which to read; |
| 1971 | they default to 0 and (length STRING) respectively. */) | 1971 | they default to 0 and (length STRING) respectively. */) |
| 1972 | (Lisp_Object string, Lisp_Object start, Lisp_Object end) | 1972 | (Lisp_Object string, Lisp_Object start, Lisp_Object end) |
diff --git a/src/xdisp.c b/src/xdisp.c index d5a7c1ca595..9e26360394c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3391,9 +3391,10 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3391 | } | 3391 | } |
| 3392 | 3392 | ||
| 3393 | /* Return the character position of the end of the display string that | 3393 | /* Return the character position of the end of the display string that |
| 3394 | started at CHARPOS. A display string is either an overlay with | 3394 | started at CHARPOS. If there's no display string at CHARPOS, |
| 3395 | `display' property whose value is a string or a `display' text | 3395 | return -1. A display string is either an overlay with `display' |
| 3396 | property whose value is a string. */ | 3396 | property whose value is a string or a `display' text property whose |
| 3397 | value is a string. */ | ||
| 3397 | EMACS_INT | 3398 | EMACS_INT |
| 3398 | compute_display_string_end (EMACS_INT charpos, struct bidi_string_data *string) | 3399 | compute_display_string_end (EMACS_INT charpos, struct bidi_string_data *string) |
| 3399 | { | 3400 | { |
| @@ -3407,8 +3408,22 @@ compute_display_string_end (EMACS_INT charpos, struct bidi_string_data *string) | |||
| 3407 | if (charpos >= eob || (string->s && !STRINGP (object))) | 3408 | if (charpos >= eob || (string->s && !STRINGP (object))) |
| 3408 | return eob; | 3409 | return eob; |
| 3409 | 3410 | ||
| 3411 | /* It could happen that the display property or overlay was removed | ||
| 3412 | since we found it in compute_display_string_pos above. One way | ||
| 3413 | this can happen is if JIT font-lock was called (through | ||
| 3414 | handle_fontified_prop), and jit-lock-functions remove text | ||
| 3415 | properties or overlays from the portion of buffer that includes | ||
| 3416 | CHARPOS. Muse mode is known to do that, for example. In this | ||
| 3417 | case, we return -1 to the caller, to signal that no display | ||
| 3418 | string is actually present at CHARPOS. See bidi_fetch_char for | ||
| 3419 | how this is handled. | ||
| 3420 | |||
| 3421 | An alternative would be to never look for display properties past | ||
| 3422 | it->stop_charpos. But neither compute_display_string_pos nor | ||
| 3423 | bidi_fetch_char that calls it know or care where the next | ||
| 3424 | stop_charpos is. */ | ||
| 3410 | if (NILP (Fget_char_property (pos, Qdisplay, object))) | 3425 | if (NILP (Fget_char_property (pos, Qdisplay, object))) |
| 3411 | abort (); | 3426 | return -1; |
| 3412 | 3427 | ||
| 3413 | /* Look forward for the first character where the `display' property | 3428 | /* Look forward for the first character where the `display' property |
| 3414 | changes. */ | 3429 | changes. */ |
| @@ -4061,40 +4076,67 @@ handle_invisible_prop (struct it *it) | |||
| 4061 | /* The position newpos is now either ZV or on visible text. */ | 4076 | /* The position newpos is now either ZV or on visible text. */ |
| 4062 | if (it->bidi_p && newpos < ZV) | 4077 | if (it->bidi_p && newpos < ZV) |
| 4063 | { | 4078 | { |
| 4064 | /* With bidi iteration, the region of invisible text | 4079 | EMACS_INT bpos = CHAR_TO_BYTE (newpos); |
| 4065 | could start and/or end in the middle of a non-base | 4080 | |
| 4066 | embedding level. Therefore, we need to skip | 4081 | if (FETCH_BYTE (bpos) == '\n' |
| 4067 | invisible text using the bidi iterator, starting at | 4082 | || (newpos > BEGV && FETCH_BYTE (bpos - 1) == '\n')) |
| 4068 | IT's current position, until we find ourselves | ||
| 4069 | outside the invisible text. Skipping invisible text | ||
| 4070 | _after_ bidi iteration avoids affecting the visual | ||
| 4071 | order of the displayed text when invisible properties | ||
| 4072 | are added or removed. */ | ||
| 4073 | if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) | ||
| 4074 | { | 4083 | { |
| 4075 | /* If we were `reseat'ed to a new paragraph, | 4084 | /* If the invisible text ends on a newline or the |
| 4076 | determine the paragraph base direction. We need | 4085 | character after a newline, we can avoid the |
| 4077 | to do it now because next_element_from_buffer may | 4086 | costly, character by character, bidi iteration to |
| 4078 | not have a chance to do it, if we are going to | 4087 | newpos, and instead simply reseat the iterator |
| 4079 | skip any text at the beginning, which resets the | 4088 | there. That's because all bidi reordering |
| 4080 | FIRST_ELT flag. */ | 4089 | information is tossed at the newline. This is a |
| 4081 | bidi_paragraph_init (it->paragraph_embedding, | 4090 | big win for modes that hide complete lines, like |
| 4082 | &it->bidi_it, 1); | 4091 | Outline, Org, etc. (Implementation note: the |
| 4092 | call to reseat_1 is necessary, because it signals | ||
| 4093 | to the bidi iterator that it needs to reinit its | ||
| 4094 | internal information when the next element for | ||
| 4095 | display is requested. */ | ||
| 4096 | struct text_pos tpos; | ||
| 4097 | |||
| 4098 | SET_TEXT_POS (tpos, newpos, bpos); | ||
| 4099 | reseat_1 (it, tpos, 0); | ||
| 4083 | } | 4100 | } |
| 4084 | do | 4101 | else /* Must use the slow method. */ |
| 4085 | { | 4102 | { |
| 4086 | bidi_move_to_visually_next (&it->bidi_it); | 4103 | /* With bidi iteration, the region of invisible text |
| 4104 | could start and/or end in the middle of a | ||
| 4105 | non-base embedding level. Therefore, we need to | ||
| 4106 | skip invisible text using the bidi iterator, | ||
| 4107 | starting at IT's current position, until we find | ||
| 4108 | ourselves outside the invisible text. Skipping | ||
| 4109 | invisible text _after_ bidi iteration avoids | ||
| 4110 | affecting the visual order of the displayed text | ||
| 4111 | when invisible properties are added or | ||
| 4112 | removed. */ | ||
| 4113 | if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) | ||
| 4114 | { | ||
| 4115 | /* If we were `reseat'ed to a new paragraph, | ||
| 4116 | determine the paragraph base direction. We | ||
| 4117 | need to do it now because | ||
| 4118 | next_element_from_buffer may not have a | ||
| 4119 | chance to do it, if we are going to skip any | ||
| 4120 | text at the beginning, which resets the | ||
| 4121 | FIRST_ELT flag. */ | ||
| 4122 | bidi_paragraph_init (it->paragraph_embedding, | ||
| 4123 | &it->bidi_it, 1); | ||
| 4124 | } | ||
| 4125 | do | ||
| 4126 | { | ||
| 4127 | bidi_move_to_visually_next (&it->bidi_it); | ||
| 4128 | } | ||
| 4129 | while (it->stop_charpos <= it->bidi_it.charpos | ||
| 4130 | && it->bidi_it.charpos < newpos); | ||
| 4131 | IT_CHARPOS (*it) = it->bidi_it.charpos; | ||
| 4132 | IT_BYTEPOS (*it) = it->bidi_it.bytepos; | ||
| 4133 | /* If we overstepped NEWPOS, record its position in | ||
| 4134 | the iterator, so that we skip invisible text if | ||
| 4135 | later the bidi iteration lands us in the | ||
| 4136 | invisible region again. */ | ||
| 4137 | if (IT_CHARPOS (*it) >= newpos) | ||
| 4138 | it->prev_stop = newpos; | ||
| 4087 | } | 4139 | } |
| 4088 | while (it->stop_charpos <= it->bidi_it.charpos | ||
| 4089 | && it->bidi_it.charpos < newpos); | ||
| 4090 | IT_CHARPOS (*it) = it->bidi_it.charpos; | ||
| 4091 | IT_BYTEPOS (*it) = it->bidi_it.bytepos; | ||
| 4092 | /* If we overstepped NEWPOS, record its position in the | ||
| 4093 | iterator, so that we skip invisible text if later the | ||
| 4094 | bidi iteration lands us in the invisible region | ||
| 4095 | again. */ | ||
| 4096 | if (IT_CHARPOS (*it) >= newpos) | ||
| 4097 | it->prev_stop = newpos; | ||
| 4098 | } | 4140 | } |
| 4099 | else | 4141 | else |
| 4100 | { | 4142 | { |
| @@ -7934,7 +7976,9 @@ move_it_in_display_line_to (struct it *it, | |||
| 7934 | ((op & MOVE_TO_POS) != 0 \ | 7976 | ((op & MOVE_TO_POS) != 0 \ |
| 7935 | && BUFFERP (it->object) \ | 7977 | && BUFFERP (it->object) \ |
| 7936 | && (IT_CHARPOS (*it) == to_charpos \ | 7978 | && (IT_CHARPOS (*it) == to_charpos \ |
| 7937 | || (!it->bidi_p && IT_CHARPOS (*it) > to_charpos) \ | 7979 | || ((!it->bidi_p \ |
| 7980 | || BIDI_AT_BASE_LEVEL (it->bidi_it)) \ | ||
| 7981 | && IT_CHARPOS (*it) > to_charpos) \ | ||
| 7938 | || (it->what == IT_COMPOSITION \ | 7982 | || (it->what == IT_COMPOSITION \ |
| 7939 | && ((IT_CHARPOS (*it) > to_charpos \ | 7983 | && ((IT_CHARPOS (*it) > to_charpos \ |
| 7940 | && to_charpos >= it->cmp_it.charpos) \ | 7984 | && to_charpos >= it->cmp_it.charpos) \ |
| @@ -7966,7 +8010,13 @@ move_it_in_display_line_to (struct it *it, | |||
| 7966 | if ((op & MOVE_TO_POS) != 0 | 8010 | if ((op & MOVE_TO_POS) != 0 |
| 7967 | && BUFFERP (it->object) | 8011 | && BUFFERP (it->object) |
| 7968 | && it->method == GET_FROM_BUFFER | 8012 | && it->method == GET_FROM_BUFFER |
| 7969 | && ((!it->bidi_p && IT_CHARPOS (*it) > to_charpos) | 8013 | && (((!it->bidi_p |
| 8014 | /* When the iterator is at base embedding level, we | ||
| 8015 | are guaranteed that characters are delivered for | ||
| 8016 | display in strictly increasing order of their | ||
| 8017 | buffer positions. */ | ||
| 8018 | || BIDI_AT_BASE_LEVEL (it->bidi_it)) | ||
| 8019 | && IT_CHARPOS (*it) > to_charpos) | ||
| 7970 | || (it->bidi_p | 8020 | || (it->bidi_p |
| 7971 | && (prev_method == GET_FROM_IMAGE | 8021 | && (prev_method == GET_FROM_IMAGE |
| 7972 | || prev_method == GET_FROM_STRETCH | 8022 | || prev_method == GET_FROM_STRETCH |