The flags[] buffer should be reset for all "flagless" bindings (i.e.
those without their no-prefix or repeat "bits" set). Without this
reset, such "flagless" bindings would be displayed with the flags of
the previous "flagged" binding (if any).

---

It seemed slightly better to make this (re)initialization
unconditional, but it could also be appended to the no-prefix/repeat
if/else-if as a final else "leg" instead. Such a conditional version
might be slightly faster, but might also be more fragile in the face
of changes to the flag presentation logic.

I noticed this problem after I did `bind -n C-\ ...`, and suddenly
the bulk of the rest of the listed bindings were also shown with "-n".

This bug also shows up with the default bindings, but it is easy to
miss. The M-1/2/3/4/5/n/o/p bindings are "plain" bindings (prefix
required, no repeating allowed), so they should not have
"-r"/"-rn"/"-n" displayed for them. However, because their immediate
predecessor in the listing is a repeatable binding (Right), these
bindings are also displayed with the "-r" flag
---
 trunk/cmd-list-keys.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/trunk/cmd-list-keys.c b/trunk/cmd-list-keys.c
index 8f957c8..c76389a 100644
--- a/trunk/cmd-list-keys.c
+++ b/trunk/cmd-list-keys.c
@@ -54,7 +54,6 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
                return (cmd_list_keys_table(self, ctx));
 
        width = 0;
-       *flags = '\0';
 
        SPLAY_FOREACH(bd, key_bindings, &key_bindings) {
                key = key_string_lookup_key(bd->key & ~KEYC_PREFIX);
@@ -78,6 +77,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
                if (key == NULL)
                        continue;
 
+               *flags = '\0';
                if (!(bd->key & KEYC_PREFIX)) {
                        if (bd->can_repeat)
                                xsnprintf(flags, sizeof flags, "-rn ");
-- 
1.7.7.4


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to