aboutsummaryrefslogtreecommitdiffstats
path: root/src/bidi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bidi.c')
-rw-r--r--src/bidi.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/bidi.c b/src/bidi.c
index e34da778ba0..763797488b0 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1448,8 +1448,14 @@ bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos)
1448 Lisp_Object start_re; 1448 Lisp_Object start_re;
1449 ptrdiff_t val; 1449 ptrdiff_t val;
1450 1450
1451 sep_re = paragraph_separate_re; 1451 if (STRINGP (BVAR (current_buffer, bidi_paragraph_separate_re)))
1452 start_re = paragraph_start_re; 1452 sep_re = BVAR (current_buffer, bidi_paragraph_separate_re);
1453 else
1454 sep_re = paragraph_separate_re;
1455 if (STRINGP (BVAR (current_buffer, bidi_paragraph_start_re)))
1456 start_re = BVAR (current_buffer, bidi_paragraph_start_re);
1457 else
1458 start_re = paragraph_start_re;
1453 1459
1454 val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil); 1460 val = fast_looking_at (sep_re, charpos, bytepos, ZV, ZV_BYTE, Qnil);
1455 if (val < 0) 1461 if (val < 0)
@@ -1523,7 +1529,10 @@ bidi_paragraph_cache_on_off (void)
1523static ptrdiff_t 1529static ptrdiff_t
1524bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte) 1530bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
1525{ 1531{
1526 Lisp_Object re = paragraph_start_re; 1532 Lisp_Object re =
1533 STRINGP (BVAR (current_buffer, bidi_paragraph_start_re))
1534 ? BVAR (current_buffer, bidi_paragraph_start_re)
1535 : paragraph_start_re;
1527 ptrdiff_t limit = ZV, limit_byte = ZV_BYTE; 1536 ptrdiff_t limit = ZV, limit_byte = ZV_BYTE;
1528 struct region_cache *bpc = bidi_paragraph_cache_on_off (); 1537 struct region_cache *bpc = bidi_paragraph_cache_on_off ();
1529 ptrdiff_t n = 0, oldpos = pos, next; 1538 ptrdiff_t n = 0, oldpos = pos, next;
@@ -3498,10 +3507,16 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
3498 if (sep_len >= 0) 3507 if (sep_len >= 0)
3499 { 3508 {
3500 bidi_it->new_paragraph = 1; 3509 bidi_it->new_paragraph = 1;
3501 /* Record the buffer position of the last character of the 3510 /* Record the buffer position of the last character of
3502 paragraph separator. */ 3511 the paragraph separator. If the paragraph separator
3503 bidi_it->separator_limit 3512 is an empty string (e.g., the regex is "^"), the
3504 = bidi_it->charpos + bidi_it->nchars + sep_len; 3513 newline that precedes the end of the paragraph is
3514 that last character. */
3515 if (sep_len > 0)
3516 bidi_it->separator_limit
3517 = bidi_it->charpos + bidi_it->nchars + sep_len;
3518 else
3519 bidi_it->separator_limit = bidi_it->charpos;
3505 } 3520 }
3506 } 3521 }
3507 } 3522 }