summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xlib.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xlib.c b/xlib.c
index a94e8f8..33e819a 100644
--- a/xlib.c
+++ b/xlib.c
@@ -401,14 +401,17 @@ static void blit_slice(struct uudisp *d, int idx, int x1, int x2)
void uudisp_refresh(struct uudisp *d, struct uuterm *t)
{
struct priv *p = (void *)&d->priv;
+ int w = t->w < d->w ? t->w : d->w;
int h = t->h < d->h ? t->h : d->h;
int x1, x2, idx, y;
/* Clean up cursor first.. */
if (p->curs_on && (!d->blink || t->x != p->curs_x || t->y != p->curs_y)) {
- idx = t->rows[p->curs_y]->idx;
- if ((unsigned)p->slices_y[idx] < d->h)
- blit_slice(d, idx, p->curs_x, p->curs_x);
+ if (p->curs_x < w && p->curs_y < h) {
+ idx = t->rows[p->curs_y]->idx;
+ if ((unsigned)p->slices_y[idx] < d->h)
+ blit_slice(d, idx, p->curs_x, p->curs_x);
+ }
p->curs_on = 0;
}