[BACK]Return to cmd-set-option.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-set-option.c between version 1.125 and 1.126

version 1.125, 2019/04/26 11:38:51 version 1.126, 2019/06/20 07:41:29
Line 92 
Line 92 
         struct options                  *oo;          struct options                  *oo;
         struct options_entry            *parent, *o;          struct options_entry            *parent, *o;
         char                            *name, *argument, *value = NULL, *cause;          char                            *name, *argument, *value = NULL, *cause;
         const char                      *target;  
         int                              window, idx, already, error, ambiguous;          int                              window, idx, already, error, ambiguous;
         struct style                    *sy;          struct style                    *sy;
   
           window = (self->entry == &cmd_set_window_option_entry);
   
         /* Expand argument. */          /* Expand argument. */
         c = cmd_find_client(item, NULL, 1);          c = cmd_find_client(item, NULL, 1);
         argument = format_single(item, args->argv[0], c, s, wl, NULL);          argument = format_single(item, args->argv[0], c, s, wl, NULL);
   
           /* If set-hook -R, fire the hook straight away. */
         if (self->entry == &cmd_set_hook_entry && args_has(args, 'R')) {          if (self->entry == &cmd_set_hook_entry && args_has(args, 'R')) {
                 notify_hook(item, argument);                  notify_hook(item, argument);
                   free(argument);
                 return (CMD_RETURN_NORMAL);                  return (CMD_RETURN_NORMAL);
         }          }
   
Line 123 
Line 126 
         else          else
                 value = xstrdup(args->argv[1]);                  value = xstrdup(args->argv[1]);
   
         /*          /* Get the scope and table for the option .*/
          * Figure out the scope: for user options it comes from the arguments,          scope = options_scope_from_name(args, window, name, fs, &oo, &cause);
          * otherwise from the option name.  
          */  
         if (*name == '@') {  
                 window = (self->entry == &cmd_set_window_option_entry);  
                 scope = options_scope_from_flags(args, window, fs, &oo, &cause);  
         } else {  
                 if (options_get_only(global_options, name) != NULL)  
                         scope = OPTIONS_TABLE_SERVER;  
                 else if (options_get_only(global_s_options, name) != NULL)  
                         scope = OPTIONS_TABLE_SESSION;  
                 else if (options_get_only(global_w_options, name) != NULL)  
                         scope = OPTIONS_TABLE_WINDOW;  
                 else {  
                         scope = OPTIONS_TABLE_NONE;  
                         xasprintf(&cause, "unknown option: %s", argument);  
                 }  
         }  
         if (scope == OPTIONS_TABLE_NONE) {          if (scope == OPTIONS_TABLE_NONE) {
                 if (args_has(args, 'q'))                  if (args_has(args, 'q'))
                         goto out;                          goto out;
                 cmdq_error(item, "%s", cause);                  cmdq_error(item, "%s", cause);
                 free(cause);                  free(cause);
                 goto fail;                  goto fail;
         }  
   
         /* Which table should this option go into? */  
         if (scope == OPTIONS_TABLE_SERVER)  
                 oo = global_options;  
         else if (scope == OPTIONS_TABLE_SESSION) {  
                 if (args_has(self->args, 'g'))  
                         oo = global_s_options;  
                 else if (s == NULL) {  
                         target = args_get(args, 't');  
                         if (target != NULL)  
                                 cmdq_error(item, "no such session: %s", target);  
                         else  
                                 cmdq_error(item, "no current session");  
                         goto fail;  
                 } else  
                         oo = s->options;  
         } else if (scope == OPTIONS_TABLE_WINDOW) {  
                 if (args_has(self->args, 'g'))  
                         oo = global_w_options;  
                 else if (wl == NULL) {  
                         target = args_get(args, 't');  
                         if (target != NULL)  
                                 cmdq_error(item, "no such window: %s", target);  
                         else  
                                 cmdq_error(item, "no current window");  
                         goto fail;  
                 } else  
                         oo = wl->window->options;  
         }          }
         o = options_get_only(oo, name);          o = options_get_only(oo, name);
         parent = options_get(oo, name);          parent = options_get(oo, name);

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126