[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.95 and 1.96

version 1.95, 2017/04/18 18:21:37 version 1.96, 2017/04/18 21:41:42
Line 46 
Line 46 
 static int      tty_keys_mouse(struct tty *, const char *, size_t, size_t *);  static int      tty_keys_mouse(struct tty *, const char *, size_t, size_t *);
 static int      tty_keys_device_attributes(struct tty *, const char *, size_t,  static int      tty_keys_device_attributes(struct tty *, const char *, size_t,
                     size_t *);                      size_t *);
 static int      tty_keys_iterm2_version(struct tty *, const char *, size_t,  
                     size_t *);  
   
 /* Default raw keys. */  /* Default raw keys. */
 struct tty_default_key_raw {  struct tty_default_key_raw {
Line 555 
Line 553 
                 goto partial_key;                  goto partial_key;
         }          }
   
         /* Or a response from iTerm2? */  
         switch (tty_keys_iterm2_version(tty, buf, len, &size)) {  
         case 0:         /* yes */  
                 key = KEYC_UNKNOWN;  
                 goto complete_key;  
         case -1:        /* no, or not valid */  
                 break;  
         case 1:         /* partial */  
                 goto partial_key;  
         }  
   
         /* Is this a mouse key press? */          /* Is this a mouse key press? */
         switch (tty_keys_mouse(tty, buf, len, &size)) {          switch (tty_keys_mouse(tty, buf, len, &size)) {
         case 0:         /* yes */          case 0:         /* yes */
Line 923 
Line 910 
   
         log_debug("%s: received DA %.*s (%s)", c->name, (int)*size, buf,          log_debug("%s: received DA %.*s (%s)", c->name, (int)*size, buf,
             types[type]);              types[type]);
         return (0);  
 }  
   
 /*  
  * Handle a version response from iTerm2. Returns 0 for success, -1 for  
  * failure, 1 for partial.  
  */  
 static int  
 tty_keys_iterm2_version(struct tty *tty, const char *buf, size_t len,  
     size_t *size)  
 {  
         struct client   *c = tty->client;  
         u_int            i;  
   
         *size = 0;  
   
         if (memcmp("\033[ITERM2 ", buf, (len > 9) ? 9 : len) != 0)  
                 return (-1);  
         if (len < 10)  
                 return (1);  
         for (i = 9; i < len; i++) {  
                 if (buf[i] == 'n')  
                         break;  
         }  
         if (i == len)  
                 return (1);  
         *size = i + 1;  
   
         tty_set_type(tty, TTY_ITERM2);  
   
         log_debug("%s: this is iTerm2", c->name);  
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96