Mercurial > emacs
comparison src/xdisp.c @ 59738:a21e342024d8
(get_glyph_string_clip_rect): Always show a cursor
glyph, even when row is only partially visible and actual cursor
position is not visible.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 27 Jan 2005 00:16:28 +0000 |
parents | 4712d3f43248 |
children | e4f04fff5ce6 |
comparison
equal
deleted
inserted
replaced
59737:4956a53e6a56 | 59738:a21e342024d8 |
---|---|
1835 /* If drawing the cursor, don't let glyph draw outside its | 1835 /* If drawing the cursor, don't let glyph draw outside its |
1836 advertised boundaries. Cleartype does this under some circumstances. */ | 1836 advertised boundaries. Cleartype does this under some circumstances. */ |
1837 if (s->hl == DRAW_CURSOR) | 1837 if (s->hl == DRAW_CURSOR) |
1838 { | 1838 { |
1839 struct glyph *glyph = s->first_glyph; | 1839 struct glyph *glyph = s->first_glyph; |
1840 int height; | 1840 int height, max_y; |
1841 | 1841 |
1842 if (s->x > r.x) | 1842 if (s->x > r.x) |
1843 { | 1843 { |
1844 r.width -= s->x - r.x; | 1844 r.width -= s->x - r.x; |
1845 r.x = s->x; | 1845 r.x = s->x; |
1846 } | 1846 } |
1847 r.width = min (r.width, glyph->pixel_width); | 1847 r.width = min (r.width, glyph->pixel_width); |
1848 | 1848 |
1849 /* Don't draw cursor glyph taller than our actual glyph. */ | 1849 /* If r.y is below window bottom, ensure that we still see a cursor. */ |
1850 height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent); | 1850 height = min (glyph->ascent + glyph->descent, |
1851 if (height < r.height) | 1851 min (FRAME_LINE_HEIGHT (s->f), s->row->visible_height)); |
1852 { | 1852 max_y = window_text_bottom_y (s->w) - height; |
1853 int max_y = r.y + r.height; | 1853 max_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, max_y); |
1854 r.y = min (max_y, s->ybase + glyph->descent - height); | 1854 if (s->ybase - glyph->ascent > max_y) |
1855 r.height = min (max_y - r.y, height); | 1855 { |
1856 r.y = max_y; | |
1857 r.height = height; | |
1858 } | |
1859 else | |
1860 { | |
1861 /* Don't draw cursor glyph taller than our actual glyph. */ | |
1862 height = max (FRAME_LINE_HEIGHT (s->f), glyph->ascent + glyph->descent); | |
1863 if (height < r.height) | |
1864 { | |
1865 max_y = r.y + r.height; | |
1866 r.y = min (max_y, max (r.y, s->ybase + glyph->descent - height)); | |
1867 r.height = min (max_y - r.y, height); | |
1868 } | |
1856 } | 1869 } |
1857 } | 1870 } |
1858 | 1871 |
1859 #ifdef CONVERT_FROM_XRECT | 1872 #ifdef CONVERT_FROM_XRECT |
1860 CONVERT_FROM_XRECT (r, *nr); | 1873 CONVERT_FROM_XRECT (r, *nr); |