From cd88d68262e85e3f57f6847f916d6ea901d5e8f0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 22 Nov 2013 18:04:49 +0200 Subject: [PATCH] Fix bug #15951 with vertical-motion near beginning of narrowed region. src/bidi.c (bidi_find_paragraph_start): Limit the returned positions to BEGV_BYTE..ZV_BYTE range. --- src/ChangeLog | 5 +++++ src/bidi.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 769b4ca6e64..994ea2d3de5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-11-22 Eli Zaretskii + + * bidi.c (bidi_find_paragraph_start): Limit the returned positions + to BEGV_BYTE..ZV_BYTE range. (Bug#15951) + 2013-11-21 Paul Eggert Fix some dependency problems that cause unnecessary recompiles. diff --git a/src/bidi.c b/src/bidi.c index dc905cd9e5f..98c3c17b78f 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -1148,6 +1148,9 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte) pos = BEGV, pos_byte = BEGV_BYTE; if (bpc) know_region_cache (current_buffer, bpc, pos, oldpos); + /* Positions returned by the region cache are not limited to + BEGV..ZV range, so we limit them here. */ + pos_byte = clip_to_bounds (BEGV_BYTE, pos_byte, ZV_BYTE); return pos_byte; } -- 2.39.2