=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-list-keys.c,v retrieving revision 1.2 retrieving revision 1.3 diff -c -r1.2 -r1.3 *** src/usr.bin/tmux/cmd-list-keys.c 2009/07/13 23:11:35 1.2 --- src/usr.bin/tmux/cmd-list-keys.c 2009/07/21 22:41:00 1.3 *************** *** 1,4 **** ! /* $OpenBSD: cmd-list-keys.c,v 1.2 2009/07/13 23:11:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-list-keys.c,v 1.3 2009/07/21 22:41:00 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 18,23 **** --- 18,25 ---- #include + #include + #include "tmux.h" /* *************** *** 45,58 **** struct key_binding *bd; const char *key; char tmp[BUFSIZ]; SPLAY_FOREACH(bd, key_bindings, &key_bindings) { if ((key = key_string_lookup_key(bd->key)) == NULL) continue; *tmp = '\0'; cmd_list_print(bd->cmdlist, tmp, sizeof tmp); ! ctx->print(ctx, "%11s: %s", key, tmp); } return (0); --- 47,73 ---- struct key_binding *bd; const char *key; char tmp[BUFSIZ]; + int width, keywidth; + width = 0; SPLAY_FOREACH(bd, key_bindings, &key_bindings) { if ((key = key_string_lookup_key(bd->key)) == NULL) continue; + keywidth = strlen(key) + 1; + if (keywidth > width) + width = keywidth; + } + + + SPLAY_FOREACH(bd, key_bindings, &key_bindings) { + if ((key = key_string_lookup_key(bd->key)) == NULL) + continue; + *tmp = '\0'; cmd_list_print(bd->cmdlist, tmp, sizeof tmp); ! ! ctx->print(ctx, "%*s: %s", width, key, tmp); } return (0);