summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2005-01-27 00:16:28 +0000
committerKim F. Storm <storm@cua.dk>2005-01-27 00:16:28 +0000
commit999f5a607e17b7565b90ff4161bebc113f65ada9 (patch)
tree66b63c87df8c99e010bd9dc1bdcec32e7456244a
parent889f36418f495a3a45c484730a1f3aa592cc08ff (diff)
downloademacs-999f5a607e17b7565b90ff4161bebc113f65ada9.tar.gz
(get_glyph_string_clip_rect): Always show a cursor
glyph, even when row is only partially visible and actual cursor position is not visible.
-rw-r--r--src/xdisp.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index d7c32be09ea..e83004d1741 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1837,7 +1837,7 @@ get_glyph_string_clip_rect (s, nr)
if (s->hl == DRAW_CURSOR)
{
struct glyph *glyph = s->first_glyph;
- int height;
+ int height, max_y;
if (s->x > r.x)
{
@@ -1846,13 +1846,26 @@ get_glyph_string_clip_rect (s, nr)
}
r.width = min (r.width, glyph->pixel_width);
- /* Don't draw cursor glyph taller than our actual glyph. */
- height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
- if (height < r.height)
+ /* If r.y is below window bottom, ensure that we still see a cursor. */
+ height = min (glyph->ascent + glyph->descent,
+ min (FRAME_LINE_HEIGHT (s->f), s->row->visible_height));
+ max_y = window_text_bottom_y (s->w) - height;
+ max_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, max_y);
+ if (s->ybase - glyph->ascent > max_y)
{
- int max_y = r.y + r.height;
- r.y = min (max_y, s->ybase + glyph->descent - height);
- r.height = min (max_y - r.y, height);
+ r.y = max_y;
+ r.height = height;
+ }
+ else
+ {
+ /* Don't draw cursor glyph taller than our actual glyph. */
+ height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent);
+ if (height < r.height)
+ {
+ max_y = r.y + r.height;
+ r.y = min (max_y, max (r.y, s->ybase + glyph->descent - height));
+ r.height = min (max_y - r.y, height);
+ }
}
}