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

Diff for /src/usr.bin/tmux/style.c between version 1.32 and 1.33

version 1.32, 2023/06/26 07:17:40 version 1.33, 2023/08/17 14:10:28
Line 37 
Line 37 
         STYLE_ALIGN_DEFAULT,          STYLE_ALIGN_DEFAULT,
         STYLE_LIST_OFF,          STYLE_LIST_OFF,
   
         STYLE_RANGE_NONE, 0,          STYLE_RANGE_NONE, 0, "",
   
         STYLE_DEFAULT_BASE          STYLE_DEFAULT_BASE
 };  };
   
   /* Set range string. */
   static void
   style_set_range_string(struct style *sy, const char *s)
   {
           strlcpy(sy->range_string, s, sizeof sy->range_string);
   }
   
 /*  /*
  * Parse an embedded style of the form "fg=colour,bg=colour,bright,...".  Note   * Parse an embedded style of the form "fg=colour,bg=colour,bright,...".  Note
  * that this adds onto the given style, so it must have been initialized   * that this adds onto the given style, so it must have been initialized
Line 104 
Line 111 
                 } else if (strcasecmp(tmp, "norange") == 0) {                  } else if (strcasecmp(tmp, "norange") == 0) {
                         sy->range_type = style_default.range_type;                          sy->range_type = style_default.range_type;
                         sy->range_argument = style_default.range_type;                          sy->range_argument = style_default.range_type;
                           strlcpy(sy->range_string, style_default.range_string,
                               sizeof sy->range_string);
                 } else if (end > 6 && strncasecmp(tmp, "range=", 6) == 0) {                  } else if (end > 6 && strncasecmp(tmp, "range=", 6) == 0) {
                         found = strchr(tmp + 6, '|');                          found = strchr(tmp + 6, '|');
                         if (found != NULL) {                          if (found != NULL) {
                                 *found++ = '\0';                                  *found++ = '\0';
                                 if (*found == '\0')                                  if (*found == '\0')
                                         goto error;                                          goto error;
                                 for (cp = found; *cp != '\0'; cp++) {  
                                         if (!isdigit((u_char)*cp))  
                                                 goto error;  
                                 }  
                         }                          }
                         if (strcasecmp(tmp + 6, "left") == 0) {                          if (strcasecmp(tmp + 6, "left") == 0) {
                                 if (found != NULL)                                  if (found != NULL)
                                         goto error;                                          goto error;
                                 sy->range_type = STYLE_RANGE_LEFT;                                  sy->range_type = STYLE_RANGE_LEFT;
                                 sy->range_argument = 0;                                  sy->range_argument = 0;
                                   style_set_range_string(sy, "");
                         } else if (strcasecmp(tmp + 6, "right") == 0) {                          } else if (strcasecmp(tmp + 6, "right") == 0) {
                                 if (found != NULL)                                  if (found != NULL)
                                         goto error;                                          goto error;
                                 sy->range_type = STYLE_RANGE_RIGHT;                                  sy->range_type = STYLE_RANGE_RIGHT;
                                 sy->range_argument = 0;                                  sy->range_argument = 0;
                                   style_set_range_string(sy, "");
                           } else if (strcasecmp(tmp + 6, "pane") == 0) {
                                   if (found == NULL)
                                           goto error;
                                   if (*found != '%' || found[1] == '\0')
                                           goto error;
                                   for (cp = found + 1; *cp != '\0'; cp++) {
                                           if (!isdigit((u_char)*cp))
                                                   goto error;
                                   }
                                   sy->range_type = STYLE_RANGE_PANE;
                                   sy->range_argument = atoi(found + 1);
                                   style_set_range_string(sy, "");
                         } else if (strcasecmp(tmp + 6, "window") == 0) {                          } else if (strcasecmp(tmp + 6, "window") == 0) {
                                 if (found == NULL)                                  if (found == NULL)
                                         goto error;                                          goto error;
                                   for (cp = found; *cp != '\0'; cp++) {
                                           if (!isdigit((u_char)*cp))
                                                   goto error;
                                   }
                                 sy->range_type = STYLE_RANGE_WINDOW;                                  sy->range_type = STYLE_RANGE_WINDOW;
                                 sy->range_argument = atoi(found);                                  sy->range_argument = atoi(found);
                                   style_set_range_string(sy, "");
                           } else if (strcasecmp(tmp + 6, "session") == 0) {
                                   if (found == NULL)
                                           goto error;
                                   if (*found != '$' || found[1] == '\0')
                                           goto error;
                                   for (cp = found + 1; *cp != '\0'; cp++) {
                                           if (!isdigit((u_char)*cp))
                                                   goto error;
                                   }
                                   sy->range_type = STYLE_RANGE_SESSION;
                                   sy->range_argument = atoi(found + 1);
                                   style_set_range_string(sy, "");
                           } else if (strcasecmp(tmp + 6, "user") == 0) {
                                   if (found == NULL)
                                           goto error;
                                   sy->range_type = STYLE_RANGE_USER;
                                   sy->range_argument = 0;
                                   style_set_range_string(sy, found);
                         }                          }
                 } else if (strcasecmp(tmp, "noalign") == 0)                  } else if (strcasecmp(tmp, "noalign") == 0)
                         sy->align = style_default.align;                          sy->align = style_default.align;
Line 222 
Line 264 
                         tmp = "left";                          tmp = "left";
                 else if (sy->range_type == STYLE_RANGE_RIGHT)                  else if (sy->range_type == STYLE_RANGE_RIGHT)
                         tmp = "right";                          tmp = "right";
                 else if (sy->range_type == STYLE_RANGE_WINDOW) {                  else if (sy->range_type == STYLE_RANGE_PANE) {
                           snprintf(b, sizeof b, "pane|%%%u", sy->range_argument);
                           tmp = b;
                   } else if (sy->range_type == STYLE_RANGE_WINDOW) {
                         snprintf(b, sizeof b, "window|%u", sy->range_argument);                          snprintf(b, sizeof b, "window|%u", sy->range_argument);
                           tmp = b;
                   } else if (sy->range_type == STYLE_RANGE_SESSION) {
                           snprintf(b, sizeof b, "session|$%u",
                               sy->range_argument);
                           tmp = b;
                   } else if (sy->range_type == STYLE_RANGE_USER) {
                           snprintf(b, sizeof b, "user|%s", sy->range_string);
                         tmp = b;                          tmp = b;
                 }                  }
                 off += xsnprintf(s + off, sizeof s - off, "%srange=%s", comma,                  off += xsnprintf(s + off, sizeof s - off, "%srange=%s", comma,

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33