aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog23
-rw-r--r--src/ChangeLog.112
-rw-r--r--src/ChangeLog.92
-rw-r--r--src/bidi.c10
-rw-r--r--src/lread.c2
-rw-r--r--src/xdisp.c122
6 files changed, 121 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4f1edc95668..4f0a0b9ab74 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,4 @@
12011-09-27 Paul Eggert <eggert@cs.ucla.edu> 12011-09-28 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): 3 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
4 (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE) 4 (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE)
@@ -775,6 +775,27 @@
775 rather than rolling our own approximation. 775 rather than rolling our own approximation.
776 (SCROLL_BAR_VEC_SIZE): Remove; not used. 776 (SCROLL_BAR_VEC_SIZE): Remove; not used.
777 777
7782011-09-28 Eli Zaretskii <eliz@gnu.org>
779
780 * xdisp.c (compute_display_string_end): If there's no display
781 string at CHARPOS, return -1.
782
783 * bidi.c (bidi_fetch_char): When compute_display_string_end
784 returns a negative value, treat the character as a normal
785 character not covered by a display string. (Bug#9624)
786
7872011-09-28 Juanma Barranquero <lekktu@gmail.com>
788
789 * lread.c (Fread_from_string): Fix typo in docstring.
790
7912011-09-27 Eli Zaretskii <eliz@gnu.org>
792
793 * xdisp.c (handle_invisible_prop): If invisible text ends on a
794 newline, reseat the iterator instead of bidi-iterating there one
795 character at a time. (Bug#9610)
796 (BUFFER_POS_REACHED_P, move_it_in_display_line_to): Bail when past
797 TO_CHARPOS if the bidi iterator is at base embedding level.
798
7782011-09-27 Andreas Schwab <schwab@linux-m68k.org> 7992011-09-27 Andreas Schwab <schwab@linux-m68k.org>
779 800
780 * lread.c (readevalloop): Use correct code for NBSP. 801 * 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
45522010-08-24 Chong Yidong <cyd@stupidchicken.com> 45522010-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 c7b3a770597..a43490f4110 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -974,6 +974,15 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *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 (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *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 1179d63436f..91195a88e63 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1971,7 +1971,7 @@ DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0,
1971 doc: /* Read one Lisp expression which is represented as text by STRING. 1971 doc: /* Read one Lisp expression which is represented as text by STRING.
1972Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX). 1972Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
1973FINAL-STRING-INDEX is an integer giving the position of the next 1973FINAL-STRING-INDEX is an integer giving the position of the next
1974 remaining chararacter in STRING. 1974 remaining character in STRING.
1975START and END optionally delimit a substring of STRING from which to read; 1975START and END optionally delimit a substring of STRING from which to read;
1976 they default to 0 and (length STRING) respectively. */) 1976 they default to 0 and (length STRING) respectively. */)
1977 (Lisp_Object string, Lisp_Object start, Lisp_Object end) 1977 (Lisp_Object string, Lisp_Object start, Lisp_Object end)
diff --git a/src/xdisp.c b/src/xdisp.c
index e6a38f76dc5..ce240922010 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3389,9 +3389,10 @@ compute_display_string_pos (struct text_pos *position,
3389} 3389}
3390 3390
3391/* Return the character position of the end of the display string that 3391/* Return the character position of the end of the display string that
3392 started at CHARPOS. A display string is either an overlay with 3392 started at CHARPOS. If there's no display string at CHARPOS,
3393 `display' property whose value is a string or a `display' text 3393 return -1. A display string is either an overlay with `display'
3394 property whose value is a string. */ 3394 property whose value is a string or a `display' text property whose
3395 value is a string. */
3395ptrdiff_t 3396ptrdiff_t
3396compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string) 3397compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string)
3397{ 3398{
@@ -3405,8 +3406,22 @@ compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string)
3405 if (charpos >= eob || (string->s && !STRINGP (object))) 3406 if (charpos >= eob || (string->s && !STRINGP (object)))
3406 return eob; 3407 return eob;
3407 3408
3409 /* It could happen that the display property or overlay was removed
3410 since we found it in compute_display_string_pos above. One way
3411 this can happen is if JIT font-lock was called (through
3412 handle_fontified_prop), and jit-lock-functions remove text
3413 properties or overlays from the portion of buffer that includes
3414 CHARPOS. Muse mode is known to do that, for example. In this
3415 case, we return -1 to the caller, to signal that no display
3416 string is actually present at CHARPOS. See bidi_fetch_char for
3417 how this is handled.
3418
3419 An alternative would be to never look for display properties past
3420 it->stop_charpos. But neither compute_display_string_pos nor
3421 bidi_fetch_char that calls it know or care where the next
3422 stop_charpos is. */
3408 if (NILP (Fget_char_property (pos, Qdisplay, object))) 3423 if (NILP (Fget_char_property (pos, Qdisplay, object)))
3409 abort (); 3424 return -1;
3410 3425
3411 /* Look forward for the first character where the `display' property 3426 /* Look forward for the first character where the `display' property
3412 changes. */ 3427 changes. */
@@ -4059,40 +4074,67 @@ handle_invisible_prop (struct it *it)
4059 /* The position newpos is now either ZV or on visible text. */ 4074 /* The position newpos is now either ZV or on visible text. */
4060 if (it->bidi_p && newpos < ZV) 4075 if (it->bidi_p && newpos < ZV)
4061 { 4076 {
4062 /* With bidi iteration, the region of invisible text 4077 ptrdiff_t bpos = CHAR_TO_BYTE (newpos);
4063 could start and/or end in the middle of a non-base 4078
4064 embedding level. Therefore, we need to skip 4079 if (FETCH_BYTE (bpos) == '\n'
4065 invisible text using the bidi iterator, starting at 4080 || (newpos > BEGV && FETCH_BYTE (bpos - 1) == '\n'))
4066 IT's current position, until we find ourselves
4067 outside the invisible text. Skipping invisible text
4068 _after_ bidi iteration avoids affecting the visual
4069 order of the displayed text when invisible properties
4070 are added or removed. */
4071 if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
4072 { 4081 {
4073 /* If we were `reseat'ed to a new paragraph, 4082 /* If the invisible text ends on a newline or the
4074 determine the paragraph base direction. We need 4083 character after a newline, we can avoid the
4075 to do it now because next_element_from_buffer may 4084 costly, character by character, bidi iteration to
4076 not have a chance to do it, if we are going to 4085 newpos, and instead simply reseat the iterator
4077 skip any text at the beginning, which resets the 4086 there. That's because all bidi reordering
4078 FIRST_ELT flag. */ 4087 information is tossed at the newline. This is a
4079 bidi_paragraph_init (it->paragraph_embedding, 4088 big win for modes that hide complete lines, like
4080 &it->bidi_it, 1); 4089 Outline, Org, etc. (Implementation note: the
4090 call to reseat_1 is necessary, because it signals
4091 to the bidi iterator that it needs to reinit its
4092 internal information when the next element for
4093 display is requested. */
4094 struct text_pos tpos;
4095
4096 SET_TEXT_POS (tpos, newpos, bpos);
4097 reseat_1 (it, tpos, 0);
4081 } 4098 }
4082 do 4099 else /* Must use the slow method. */
4083 { 4100 {
4084 bidi_move_to_visually_next (&it->bidi_it); 4101 /* With bidi iteration, the region of invisible text
4102 could start and/or end in the middle of a
4103 non-base embedding level. Therefore, we need to
4104 skip invisible text using the bidi iterator,
4105 starting at IT's current position, until we find
4106 ourselves outside the invisible text. Skipping
4107 invisible text _after_ bidi iteration avoids
4108 affecting the visual order of the displayed text
4109 when invisible properties are added or
4110 removed. */
4111 if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
4112 {
4113 /* If we were `reseat'ed to a new paragraph,
4114 determine the paragraph base direction. We
4115 need to do it now because
4116 next_element_from_buffer may not have a
4117 chance to do it, if we are going to skip any
4118 text at the beginning, which resets the
4119 FIRST_ELT flag. */
4120 bidi_paragraph_init (it->paragraph_embedding,
4121 &it->bidi_it, 1);
4122 }
4123 do
4124 {
4125 bidi_move_to_visually_next (&it->bidi_it);
4126 }
4127 while (it->stop_charpos <= it->bidi_it.charpos
4128 && it->bidi_it.charpos < newpos);
4129 IT_CHARPOS (*it) = it->bidi_it.charpos;
4130 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
4131 /* If we overstepped NEWPOS, record its position in
4132 the iterator, so that we skip invisible text if
4133 later the bidi iteration lands us in the
4134 invisible region again. */
4135 if (IT_CHARPOS (*it) >= newpos)
4136 it->prev_stop = newpos;
4085 } 4137 }
4086 while (it->stop_charpos <= it->bidi_it.charpos
4087 && it->bidi_it.charpos < newpos);
4088 IT_CHARPOS (*it) = it->bidi_it.charpos;
4089 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
4090 /* If we overstepped NEWPOS, record its position in the
4091 iterator, so that we skip invisible text if later the
4092 bidi iteration lands us in the invisible region
4093 again. */
4094 if (IT_CHARPOS (*it) >= newpos)
4095 it->prev_stop = newpos;
4096 } 4138 }
4097 else 4139 else
4098 { 4140 {
@@ -7886,7 +7928,9 @@ move_it_in_display_line_to (struct it *it,
7886 ((op & MOVE_TO_POS) != 0 \ 7928 ((op & MOVE_TO_POS) != 0 \
7887 && BUFFERP (it->object) \ 7929 && BUFFERP (it->object) \
7888 && (IT_CHARPOS (*it) == to_charpos \ 7930 && (IT_CHARPOS (*it) == to_charpos \
7889 || (!it->bidi_p && IT_CHARPOS (*it) > to_charpos) \ 7931 || ((!it->bidi_p \
7932 || BIDI_AT_BASE_LEVEL (it->bidi_it)) \
7933 && IT_CHARPOS (*it) > to_charpos) \
7890 || (it->what == IT_COMPOSITION \ 7934 || (it->what == IT_COMPOSITION \
7891 && ((IT_CHARPOS (*it) > to_charpos \ 7935 && ((IT_CHARPOS (*it) > to_charpos \
7892 && to_charpos >= it->cmp_it.charpos) \ 7936 && to_charpos >= it->cmp_it.charpos) \
@@ -7918,7 +7962,13 @@ move_it_in_display_line_to (struct it *it,
7918 if ((op & MOVE_TO_POS) != 0 7962 if ((op & MOVE_TO_POS) != 0
7919 && BUFFERP (it->object) 7963 && BUFFERP (it->object)
7920 && it->method == GET_FROM_BUFFER 7964 && it->method == GET_FROM_BUFFER
7921 && ((!it->bidi_p && IT_CHARPOS (*it) > to_charpos) 7965 && (((!it->bidi_p
7966 /* When the iterator is at base embedding level, we
7967 are guaranteed that characters are delivered for
7968 display in strictly increasing order of their
7969 buffer positions. */
7970 || BIDI_AT_BASE_LEVEL (it->bidi_it))
7971 && IT_CHARPOS (*it) > to_charpos)
7922 || (it->bidi_p 7972 || (it->bidi_p
7923 && (prev_method == GET_FROM_IMAGE 7973 && (prev_method == GET_FROM_IMAGE
7924 || prev_method == GET_FROM_STRETCH 7974 || prev_method == GET_FROM_STRETCH