From: Christian Heller Date: Wed, 10 Jul 2013 11:41:42 +0000 (+0200) Subject: Made draw_info_win() use new center_offset () for scrolling. X-Git-Tag: tce~1161 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/static/blog?a=commitdiff_plain;h=0434fa6bdfd2a7195bf64d5fe50f5b8cfd0c38fc;p=plomrogue Made draw_info_win() use new center_offset () for scrolling. --- diff --git a/src/draw_wins.c b/src/draw_wins.c index d44d257..fcdda05 100644 --- a/src/draw_wins.c +++ b/src/draw_wins.c @@ -111,13 +111,8 @@ extern void draw_info_win (struct Win * win) { extern void draw_keys_win (struct Win * win) { // Draw keybindings window. struct World * world = (struct World *) win->data; - uint16_t offset = 0, y, x; - if (world->keyswindata->max >= win->frame.size.y) { - if (world->keyswindata->select > win->frame.size.y / 2) { - if (world->keyswindata->select < (world->keyswindata->max - (win->frame.size.y / 2))) - offset = world->keyswindata->select - (win->frame.size.y / 2); - else - offset = world->keyswindata->max - win->frame.size.y + 1; } } + uint16_t offset, y, x; + offset = center_offset (world->keyswindata->select, world->keyswindata->max, win->frame.size.y - 1); uint8_t keydescwidth = 9 + 1; // max length assured by get_keyname() + \0 char * keydesc = malloc(keydescwidth), * keyname; attr_t attri;