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

Diff for /src/usr.bin/tmux/cmd-unbind-key.c between version 1.28 and 1.29

version 1.28, 2016/10/14 22:14:22 version 1.29, 2016/10/16 19:04:05
Line 26 
Line 26 
  * Unbind key from command.   * Unbind key from command.
  */   */
   
 static enum cmd_retval  cmd_unbind_key_exec(struct cmd *, struct cmd_q *);  static enum cmd_retval  cmd_unbind_key_exec(struct cmd *, struct cmdq_item *);
 static enum cmd_retval  cmd_unbind_key_mode_table(struct cmd *, struct cmd_q *,  
                             key_code);  
   
   static enum cmd_retval  cmd_unbind_key_mode_table(struct cmd *,
                               struct cmdq_item *, key_code);
   
 const struct cmd_entry cmd_unbind_key_entry = {  const struct cmd_entry cmd_unbind_key_entry = {
         .name = "unbind-key",          .name = "unbind-key",
         .alias = "unbind",          .alias = "unbind",
Line 42 
Line 43 
 };  };
   
 static enum cmd_retval  static enum cmd_retval
 cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)  cmd_unbind_key_exec(struct cmd *self, struct cmdq_item *item)
 {  {
         struct args     *args = self->args;          struct args     *args = self->args;
         key_code         key;          key_code         key;
Line 50 
Line 51 
   
         if (!args_has(args, 'a')) {          if (!args_has(args, 'a')) {
                 if (args->argc != 1) {                  if (args->argc != 1) {
                         cmdq_error(cmdq, "missing key");                          cmdq_error(item, "missing key");
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
                 key = key_string_lookup_string(args->argv[0]);                  key = key_string_lookup_string(args->argv[0]);
                 if (key == KEYC_NONE || key == KEYC_UNKNOWN) {                  if (key == KEYC_NONE || key == KEYC_UNKNOWN) {
                         cmdq_error(cmdq, "unknown key: %s", args->argv[0]);                          cmdq_error(item, "unknown key: %s", args->argv[0]);
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
         } else {          } else {
                 if (args->argc != 0) {                  if (args->argc != 0) {
                         cmdq_error(cmdq, "key given with -a");                          cmdq_error(item, "key given with -a");
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
                 key = KEYC_UNKNOWN;                  key = KEYC_UNKNOWN;
         }          }
   
         if (args_has(args, 't'))          if (args_has(args, 't'))
                 return (cmd_unbind_key_mode_table(self, cmdq, key));                  return (cmd_unbind_key_mode_table(self, item, key));
   
         if (key == KEYC_UNKNOWN) {          if (key == KEYC_UNKNOWN) {
                 tablename = args_get(args, 'T');                  tablename = args_get(args, 'T');
Line 77 
Line 78 
                         return (CMD_RETURN_NORMAL);                          return (CMD_RETURN_NORMAL);
                 }                  }
                 if (key_bindings_get_table(tablename, 0) == NULL) {                  if (key_bindings_get_table(tablename, 0) == NULL) {
                         cmdq_error(cmdq, "table %s doesn't exist", tablename);                          cmdq_error(item, "table %s doesn't exist", tablename);
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
                 key_bindings_remove_table(tablename);                  key_bindings_remove_table(tablename);
Line 87 
Line 88 
         if (args_has(args, 'T')) {          if (args_has(args, 'T')) {
                 tablename = args_get(args, 'T');                  tablename = args_get(args, 'T');
                 if (key_bindings_get_table(tablename, 0) == NULL) {                  if (key_bindings_get_table(tablename, 0) == NULL) {
                         cmdq_error(cmdq, "table %s doesn't exist", tablename);                          cmdq_error(item, "table %s doesn't exist", tablename);
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
         } else if (args_has(args, 'n'))          } else if (args_has(args, 'n'))
Line 99 
Line 100 
 }  }
   
 static enum cmd_retval  static enum cmd_retval
 cmd_unbind_key_mode_table(struct cmd *self, struct cmd_q *cmdq, key_code key)  cmd_unbind_key_mode_table(struct cmd *self, struct cmdq_item *item,
       key_code key)
 {  {
         struct args                     *args = self->args;          struct args                     *args = self->args;
         const char                      *tablename;          const char                      *tablename;
Line 108 
Line 110 
   
         tablename = args_get(args, 't');          tablename = args_get(args, 't');
         if ((mtab = mode_key_findtable(tablename)) == NULL) {          if ((mtab = mode_key_findtable(tablename)) == NULL) {
                 cmdq_error(cmdq, "unknown key table: %s", tablename);                  cmdq_error(item, "unknown key table: %s", tablename);
                 return (CMD_RETURN_ERROR);                  return (CMD_RETURN_ERROR);
         }          }
   

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29