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

Diff for /src/usr.bin/tmux/tty-keys.c between version 1.14 and 1.15

version 1.14, 2009/11/05 08:45:08 version 1.15, 2009/11/05 10:44:36
Line 29 
Line 29 
  * Handle keys input from the outside terminal.   * Handle keys input from the outside terminal.
  */   */
   
 void    tty_keys_add(struct tty *, const char *, int, int);  void    tty_keys_add(struct tty *, const char *, int);
 void    tty_keys_callback(int, short, void *);  void    tty_keys_callback(int, short, void *);
 int     tty_keys_mouse(char *, size_t, size_t *, struct mouse_event *);  int     tty_keys_mouse(char *, size_t, size_t *, struct mouse_event *);
   
Line 39 
Line 39 
   
         int                     key;          int                     key;
         int                     flags;          int                     flags;
   #define TTYKEY_CTRL 0x1
   #define TTYKEY_RAW 0x2
 };  };
   
 struct tty_key_ent tty_keys[] = {  struct tty_key_ent tty_keys[] = {
Line 195 
Line 197 
 }  }
   
 void  void
 tty_keys_add(struct tty *tty, const char *s, int key, int flags)  tty_keys_add(struct tty *tty, const char *s, int key)
 {  {
         struct tty_key  *tk, *tl;          struct tty_key  *tk, *tl;
   
         tk = xmalloc(sizeof *tk);          tk = xmalloc(sizeof *tk);
         tk->string = xstrdup(s);          tk->string = xstrdup(s);
         tk->key = key;          tk->key = key;
         tk->flags = flags;  
   
         if ((tl = RB_INSERT(tty_keys, &tty->ktree, tk)) != NULL) {          if ((tl = RB_INSERT(tty_keys, &tty->ktree, tk)) != NULL) {
                 xfree(tk->string);                  xfree(tk->string);
Line 240 
Line 241 
                                 continue;                                  continue;
                 }                  }
   
                 tty_keys_add(tty, s + 1, tke->key, tke->flags);                  tty_keys_add(tty, s + 1, tke->key);
                 if (tke->flags & TTYKEY_CTRL) {                  if (tke->flags & TTYKEY_CTRL) {
                         if (strlcpy(tmp, s, sizeof tmp) >= sizeof tmp)                          if (strlcpy(tmp, s, sizeof tmp) >= sizeof tmp)
                                 continue;                                  continue;
                         tmp[strlen(tmp) - 1] ^= 0x20;                          tmp[strlen(tmp) - 1] ^= 0x20;
                         tty_keys_add(tty, tmp + 1, tke->key | KEYC_CTRL, 0);                          tty_keys_add(tty, tmp + 1, tke->key | KEYC_CTRL);
                 }                  }
         }          }
 }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15