Mercurial > hg > xemacs-beta
diff src/redisplay.c @ 116:9f59509498e1 r20-1b10
Import from CVS: tag r20-1b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:23:06 +0200 |
parents | fe104dbd9147 |
children | cca96a509cfe |
line wrap: on
line diff
--- a/src/redisplay.c Mon Aug 13 09:21:56 2007 +0200 +++ b/src/redisplay.c Mon Aug 13 09:23:06 2007 +0200 @@ -6660,7 +6660,8 @@ { struct buffer *b = XBUFFER (w->buffer); int cur_elt; - Bufpos cur_pos; + Bufpos cur_pos, prev_pos = point; + int point_line_height; int pixheight = pixpos - WINDOW_TEXT_TOP (w); validate_line_start_cache (w); @@ -6670,6 +6671,9 @@ /* #### See comment in update_line_start_cache about big minibuffers. */ if (cur_elt < 0) return point; + + point_line_height = Dynarr_atp (w->line_start_cache, cur_elt)->height; + while (1) { cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; @@ -6681,7 +6685,12 @@ if (pixheight < 0) { w->line_cache_validation_override--; - return cur_pos; + 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; } cur_elt--; @@ -6707,6 +6716,7 @@ cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; assert (cur_elt >= 0); } + prev_pos = cur_pos; } }