# HG changeset patch # User Aidan Kehoe # Date 1390264036 0 # Node ID cfc6a8c144f16b2598435cfb0aa8a2a48204c947 # Parent 7277cf461612be80403c68d3368a5b3329210e3d Don't return a Charbpos before visible region, start_with_line_at_pixpos() src/ChangeLog addition: 2014-01-21 Aidan Kehoe * redisplay.c (start_with_line_at_pixpos): Apply Julian Bradfield's change of slrnlc7tnv.l3h.jcb@home.stevens-bradfield.com , never returning a Charbpos before the visible region. Thank you Julian! diff -r 7277cf461612 -r cfc6a8c144f1 src/ChangeLog --- a/src/ChangeLog Mon Jan 20 18:13:15 2014 +0000 +++ b/src/ChangeLog Tue Jan 21 00:27:16 2014 +0000 @@ -1,3 +1,10 @@ +2014-01-21 Aidan Kehoe + + * redisplay.c (start_with_line_at_pixpos): + Apply Julian Bradfield's change of + slrnlc7tnv.l3h.jcb@home.stevens-bradfield.com , never returning a + Charbpos before the visible region. Thank you Julian! + 2014-01-20 Aidan Kehoe * fileio.c (Fcopy_file, Finsert_file_contents_internal): diff -r 7277cf461612 -r cfc6a8c144f1 src/redisplay.c --- a/src/redisplay.c Mon Jan 20 18:13:15 2014 +0000 +++ b/src/redisplay.c Tue Jan 21 00:27:16 2014 +0000 @@ -8287,12 +8287,15 @@ if (pixheight < 0) { w->line_cache_validation_override--; - if (-pixheight > point_line_height) - /* We can't make the target line cover pixpos, so put it - above pixpos. That way it will at least be visible. */ - return prev_pos; - else - return cur_pos; + /* I see no reason why cur_pos can't be before BEGV + here, so check for it. It's not clear to me whether + prev_pos could be before BEGV, so check that as well. */ + if (-pixheight > point_line_height) + /* We can't make the target line cover pixpos, so put it + above pixpos. That way it will at least be visible. */ + return (prev_pos <= BUF_BEGV (b)) ? BUF_BEGV (b) : prev_pos; + else + return (cur_pos <= BUF_BEGV (b)) ? BUF_BEGV (b) : cur_pos; } cur_elt--;