Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
115:f109f7dabbe2 | 116:9f59509498e1 |
---|---|
6658 Bufpos | 6658 Bufpos |
6659 start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos) | 6659 start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos) |
6660 { | 6660 { |
6661 struct buffer *b = XBUFFER (w->buffer); | 6661 struct buffer *b = XBUFFER (w->buffer); |
6662 int cur_elt; | 6662 int cur_elt; |
6663 Bufpos cur_pos; | 6663 Bufpos cur_pos, prev_pos = point; |
6664 int point_line_height; | |
6664 int pixheight = pixpos - WINDOW_TEXT_TOP (w); | 6665 int pixheight = pixpos - WINDOW_TEXT_TOP (w); |
6665 | 6666 |
6666 validate_line_start_cache (w); | 6667 validate_line_start_cache (w); |
6667 w->line_cache_validation_override++; | 6668 w->line_cache_validation_override++; |
6668 | 6669 |
6669 cur_elt = point_in_line_start_cache (w, point, 0); | 6670 cur_elt = point_in_line_start_cache (w, point, 0); |
6670 /* #### See comment in update_line_start_cache about big minibuffers. */ | 6671 /* #### See comment in update_line_start_cache about big minibuffers. */ |
6671 if (cur_elt < 0) | 6672 if (cur_elt < 0) |
6672 return point; | 6673 return point; |
6674 | |
6675 point_line_height = Dynarr_atp (w->line_start_cache, cur_elt)->height; | |
6676 | |
6673 while (1) | 6677 while (1) |
6674 { | 6678 { |
6675 cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; | 6679 cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; |
6676 | 6680 |
6677 pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; | 6681 pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; |
6679 /* Do not take into account the value of vertical_clip here. | 6683 /* Do not take into account the value of vertical_clip here. |
6680 That is the responsibility of the calling functions. */ | 6684 That is the responsibility of the calling functions. */ |
6681 if (pixheight < 0) | 6685 if (pixheight < 0) |
6682 { | 6686 { |
6683 w->line_cache_validation_override--; | 6687 w->line_cache_validation_override--; |
6684 return cur_pos; | 6688 if (-pixheight > point_line_height) |
6689 /* We can't make the target line cover pixpos, so put it | |
6690 above pixpos. That way it will at least be visible. */ | |
6691 return prev_pos; | |
6692 else | |
6693 return cur_pos; | |
6685 } | 6694 } |
6686 | 6695 |
6687 cur_elt--; | 6696 cur_elt--; |
6688 if (cur_elt < 0) | 6697 if (cur_elt < 0) |
6689 { | 6698 { |
6705 update_line_start_cache (w, from, to, point, 0); | 6714 update_line_start_cache (w, from, to, point, 0); |
6706 | 6715 |
6707 cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; | 6716 cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; |
6708 assert (cur_elt >= 0); | 6717 assert (cur_elt >= 0); |
6709 } | 6718 } |
6719 prev_pos = cur_pos; | |
6710 } | 6720 } |
6711 } | 6721 } |
6712 | 6722 |
6713 /* For window W, what does the starting position have to be so that | 6723 /* For window W, what does the starting position have to be so that |
6714 the line containing point is on display line LINE. If LINE is | 6724 the line containing point is on display line LINE. If LINE is |