+static uint16_t draw_titled_keybinding_list(struct World * world,
+ struct Win * win, uint16_t start,
+ char * title,
+ struct KeyBinding * kb_p)
+{
+ uint16_t x, y;
+ uint16_t i = 0;
+ uint8_t state = 0;
+ for (y = start; y < win->frame.size.y && (0 == state || 0 != kb_p); y++)
+ {
+ if (0 == state)
+ {
+ for (x = 0; x < win->frame.size.x; x++)
+ {
+ if (i == strlen(title))
+ {
+ y++;
+ state = 1 + (0 == kb_p);
+ i = 0;
+ break;
+ }
+ mvwaddch(win->frame.curses_win, y, x, title[i]);
+ i++;
+ }
+ continue;
+ }
+ char * keyname = get_name_to_keycode(world, kb_p->key);
+ char * cmd_dsc = get_command_longdsc(world, kb_p->name);
+ char line[9 + 1 + strlen(cmd_dsc) + 1];
+ sprintf(line, "%-9s %s", keyname, cmd_dsc);
+ free(keyname);
+ kb_p = kb_p->next;
+ draw_line(win, y, line);
+ }
+ if (2 == state)
+ {
+ char * line = "(none)";
+ draw_line(win, y, line);
+ y++;
+ }
+ return y;
+}
+
+
+