Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 42:8b8b7f3559a2 r19-15b104
Import from CVS: tag r19-15b104
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:54:51 +0200 |
parents | e04119814345 |
children | 56c54cf7c5b6 |
comparison
equal
deleted
inserted
replaced
41:5d6df4963a99 | 42:8b8b7f3559a2 |
---|---|
6633 Bufpos | 6633 Bufpos |
6634 start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos) | 6634 start_with_line_at_pixpos (struct window *w, Bufpos point, int pixpos) |
6635 { | 6635 { |
6636 struct buffer *b = XBUFFER (w->buffer); | 6636 struct buffer *b = XBUFFER (w->buffer); |
6637 int cur_elt; | 6637 int cur_elt; |
6638 Bufpos cur_pos; | 6638 Bufpos cur_pos, prev_pos = point; |
6639 int point_line_height; | |
6639 int pixheight = pixpos - WINDOW_TEXT_TOP (w); | 6640 int pixheight = pixpos - WINDOW_TEXT_TOP (w); |
6640 | 6641 |
6641 validate_line_start_cache (w); | 6642 validate_line_start_cache (w); |
6642 w->line_cache_validation_override++; | 6643 w->line_cache_validation_override++; |
6643 | 6644 |
6644 cur_elt = point_in_line_start_cache (w, point, 0); | 6645 cur_elt = point_in_line_start_cache (w, point, 0); |
6645 /* #### See comment in update_line_start_cache about big minibuffers. */ | 6646 /* #### See comment in update_line_start_cache about big minibuffers. */ |
6646 if (cur_elt < 0) | 6647 if (cur_elt < 0) |
6647 return point; | 6648 return point; |
6649 | |
6650 point_line_height = Dynarr_atp (w->line_start_cache, cur_elt)->height; | |
6651 | |
6648 while (1) | 6652 while (1) |
6649 { | 6653 { |
6650 cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; | 6654 cur_pos = Dynarr_atp (w->line_start_cache, cur_elt)->start; |
6651 | 6655 |
6652 pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; | 6656 pixheight -= Dynarr_atp (w->line_start_cache, cur_elt)->height; |
6654 /* Do not take into account the value of vertical_clip here. | 6658 /* Do not take into account the value of vertical_clip here. |
6655 That is the responsibility of the calling functions. */ | 6659 That is the responsibility of the calling functions. */ |
6656 if (pixheight < 0) | 6660 if (pixheight < 0) |
6657 { | 6661 { |
6658 w->line_cache_validation_override--; | 6662 w->line_cache_validation_override--; |
6659 return cur_pos; | 6663 if (-pixheight > point_line_height) |
6664 /* We can't make the target line cover pixpos, so put it | |
6665 above pixpos. That way it will at least be visible. */ | |
6666 return prev_pos; | |
6667 else | |
6668 return cur_pos; | |
6660 } | 6669 } |
6661 | 6670 |
6662 cur_elt--; | 6671 cur_elt--; |
6663 if (cur_elt < 0) | 6672 if (cur_elt < 0) |
6664 { | 6673 { |
6680 update_line_start_cache (w, from, to, point, 0); | 6689 update_line_start_cache (w, from, to, point, 0); |
6681 | 6690 |
6682 cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; | 6691 cur_elt = point_in_line_start_cache (w, cur_pos, 2) - 1; |
6683 assert (cur_elt >= 0); | 6692 assert (cur_elt >= 0); |
6684 } | 6693 } |
6694 prev_pos = cur_pos; | |
6685 } | 6695 } |
6686 } | 6696 } |
6687 | 6697 |
6688 /* For window W, what does the starting position have to be so that | 6698 /* For window W, what does the starting position have to be so that |
6689 the line containing point is on display line LINE. If LINE is | 6699 the line containing point is on display line LINE. If LINE is |