[COMMIT] Don't return a Charbpos before visible region, start_with_line_at_pixpos()
Aidan Kehoe <[email protected]>
| Newsgroups | gmane.emacs.xemacs.patches |
|---|---|
| Message-ID | <[email protected]> |
Thank you Julian! APPROVE COMMIT NOTE: This patch has been committed. # HG changeset patch # User Aidan Kehoe <[email protected]> # 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 <[email protected]> * redisplay.c (start_with_line_at_pixpos): Apply Julian Bradfield's change of [email protected] , 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 <[email protected]> + + * redisplay.c (start_with_line_at_pixpos): + Apply Julian Bradfield's change of + [email protected] , never returning a + Charbpos before the visible region. Thank you Julian! + 2014-01-20 Aidan Kehoe <[email protected]> * 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--; -- ‘Liston operated so fast that he once accidentally amputated an assistant’s fingers along with a patient’s leg, […] The patient and the assistant both died of sepsis, and a spectator reportedly died of shock, resulting in the only known procedure with a 300% mortality.’ (Atul Gawande, NEJM, 2012) _______________________________________________ XEmacs-Patches mailing list [email protected] http://lists.xemacs.org/mailman/listinfo/xemacs-patches