[BACK]Return to menu.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/menu.c between version 1.40 and 1.41

version 1.40, 2021/10/22 17:12:50 version 1.41, 2021/11/11 09:22:33
Line 89 
Line 89 
                 keylen = strlen(key) + 3; /* 3 = space and two brackets */                  keylen = strlen(key) + 3; /* 3 = space and two brackets */
   
                 /*                  /*
                  * Only add the key if there is space for the entire item text                   * Add the key if it is shorter than a quarter of the available
                  * and the key.                   * space or there is space for the entire item text and the
                    * key.
                  */                   */
                 if (keylen >= max_width || slen >= max_width - keylen)                  if (keylen <= max_width / 4)
                           max_width -= keylen;
                   else if (keylen >= max_width || slen >= max_width - keylen)
                         key = NULL;                          key = NULL;
         }          }
   
           if (slen > max_width) {
                   max_width--;
                   suffix = ">";
           }
         if (key != NULL)          if (key != NULL)
                 xasprintf(&name, "%s#[default] #[align=right](%s)", s, key);                  xasprintf(&name, "%.*s%s#[default] #[align=right](%s)",
         else {                      (int)max_width, s, suffix, key);
                 if (slen > max_width) {          else
                         max_width--;  
                         suffix = ">";  
                 }  
                 xasprintf(&name, "%.*s%s", (int)max_width, s, suffix);                  xasprintf(&name, "%.*s%s", (int)max_width, s, suffix);
         }  
         new_item->name = name;          new_item->name = name;
         free(s);          free(s);
   

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.41