- ch = FETCH_CHAR (bytepos);
- ch_len = CHAR_BYTES (ch);
- pos = BYTE_TO_CHAR (bytepos);
- type = bidi_get_type (ch, NEUTRAL_DIR);
-
- for (pos++, bytepos += ch_len;
- /* NOTE: UAX#9 says to search only for L, AL, or R types of
- characters, and ignore RLE, RLO, LRE, and LRO. However,
- I'm not sure it makes sense to omit those 4; should try
- with and without that to see the effect. */
- (bidi_get_category (type) != STRONG)
- || (bidi_ignore_explicit_marks_for_paragraph_level
- && (type == RLE || type == RLO
- || type == LRE || type == LRO));
- type = bidi_get_type (ch, NEUTRAL_DIR))
- {
- if (type == NEUTRAL_B && bidi_at_paragraph_end (pos, bytepos) >= -1)
- break;
- if (bytepos >= ZV_BYTE)
- {
- /* Pretend there's a paragraph separator at end of buffer. */
- type = NEUTRAL_B;
+
+ /* The following loop is run more than once only if NO_DEFAULT_P
+ is non-zero. */
+ do {
+ bytepos = pstartbyte;
+ ch = FETCH_CHAR (bytepos);
+ ch_len = CHAR_BYTES (ch);
+ pos = BYTE_TO_CHAR (bytepos);
+ type = bidi_get_type (ch, NEUTRAL_DIR);
+
+ for (pos++, bytepos += ch_len;
+ /* NOTE: UAX#9 says to search only for L, AL, or R types
+ of characters, and ignore RLE, RLO, LRE, and LRO.
+ However, I'm not sure it makes sense to omit those 4;
+ should try with and without that to see the effect. */
+ (bidi_get_category (type) != STRONG)
+ || (bidi_ignore_explicit_marks_for_paragraph_level
+ && (type == RLE || type == RLO
+ || type == LRE || type == LRO));
+ type = bidi_get_type (ch, NEUTRAL_DIR))
+ {
+ if (type == NEUTRAL_B && bidi_at_paragraph_end (pos, bytepos) >= -1)