-
- struct KeyBinding * kb_p;
- kb_p = get_keyb_of_n(kb->kbs, (y - start) + offset);
- char * keyname = get_name_to_keycode(world, kb_p->key);
- snprintf(keydesc, keydescwidth, "%-9s", keyname);
- free(keyname);
- char * cmd_dsc = get_command_longdsc(world, kb_p->name);
- uint8_t dsclen = strlen(keydesc);
- for (x = 0; x < win->frame.size.x; x++)
- {
- if (x < dsclen)
- {
- mvwaddch(win->frame.curses_win, y, x, keydesc[x] | attri);
- continue;
- }
- else if (dsclen < x && x < strlen(cmd_dsc) + strlen(keydesc) + 1)
- {
- chtype ch = cmd_dsc[x - strlen(keydesc) - 1] | attri;
- mvwaddch(win->frame.curses_win, y, x, ch);
- continue;
- }
- mvwaddch(win->frame.curses_win, y, x, ' ' | attri);
- }
-
+ char * kb_line = get_kb_line_and_iterate(world, &kb_p);
+ draw_line(win, y, kb_line, attri, 1);
+ free(kb_line);