mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Stop drawing when menu doesn't fit inside the screen; picked from a
larger diff from Alexander Polakov.
This commit is contained in:
parent
871fdf5671
commit
c21d56e5a1
7
menu.c
7
menu.c
@ -387,9 +387,14 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
||||
TAILQ_FOREACH(mi, resultq, resultentry) {
|
||||
char *text = mi->print[0] != '\0' ?
|
||||
mi->print : mi->text;
|
||||
int y = n * font_height(sc) + font_ascent(sc) + 1;
|
||||
|
||||
/* Stop drawing when menu doesn't fit inside the screen. */
|
||||
if (mc->y + y > ymax)
|
||||
break;
|
||||
|
||||
font_draw(sc, text, MIN(strlen(text), MENU_MAXENTRY),
|
||||
sc->menuwin, 0, n * font_height(sc) + font_ascent(sc) + 1);
|
||||
sc->menuwin, 0, y);
|
||||
n++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user