[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.81 and 1.82

version 1.81, 2015/11/18 14:27:44 version 1.82, 2015/11/23 20:53:09
Line 481 
Line 481 
         /* Get key buffer. */          /* Get key buffer. */
         buf = EVBUFFER_DATA(tty->event->input);          buf = EVBUFFER_DATA(tty->event->input);
         len = EVBUFFER_LENGTH(tty->event->input);          len = EVBUFFER_LENGTH(tty->event->input);
   
         if (len == 0)          if (len == 0)
                 return (0);                  return (0);
         log_debug("keys are %zu (%.*s)", len, (int) len, buf);          log_debug("keys are %zu (%.*s)", len, (int) len, buf);
Line 653 
Line 654 
 tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)  tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
 {  {
         struct mouse_event      *m = &tty->mouse;          struct mouse_event      *m = &tty->mouse;
         struct utf8_data         ud;          u_int                    i, x, y, b, sgr_b;
         u_int                    i, value, x, y, b, sgr_b;  
         u_char                   sgr_type, c;          u_char                   sgr_type, c;
         enum utf8_state          more;  
   
         /*          /*
          * Standard mouse sequences are \033[M followed by three characters           * Standard mouse sequences are \033[M followed by three characters
Line 686 
Line 685 
                 return (1);                  return (1);
   
         /*          /*
          * Third byte is M in old standard and UTF-8 extension, < in SGR           * Third byte is M in old standard (and UTF-8 extension which we do not
          * extension.           * support), < in SGR extension.
          */           */
         if (buf[2] == 'M') {          if (buf[2] == 'M') {
                 /* Read the three inputs. */                  /* Read the three inputs. */
Line 695 
Line 694 
                 for (i = 0; i < 3; i++) {                  for (i = 0; i < 3; i++) {
                         if (len <= *size)                          if (len <= *size)
                                 return (1);                                  return (1);
                           c = (u_char)buf[(*size)++];
                         if (tty->mode & MODE_MOUSE_UTF8) {  
                                 if (utf8_open(&ud, buf[*size]) == UTF8_MORE) {  
                                         if (ud.size != 2)  
                                                 return (-1);  
                                         (*size)++;  
                                         if (len <= *size)  
                                                 return (1);  
                                         more = utf8_append(&ud, buf[*size]);  
                                         if (more != UTF8_DONE)  
                                                 return (-1);  
                                         value = utf8_combine(&ud);  
                                 } else  
                                         value = (u_char)buf[*size];  
                                 (*size)++;  
                         } else {  
                                 value = (u_char)buf[*size];  
                                 (*size)++;  
                         }  
   
                         if (i == 0)                          if (i == 0)
                                 b = value;                                  b = c;
                         else if (i == 1)                          else if (i == 1)
                                 x = value;                                  x = c;
                         else                          else
                                 y = value;                                  y = c;
                 }                  }
                 log_debug("mouse input: %.*s", (int)*size, buf);                  log_debug("mouse input: %.*s", (int)*size, buf);
   

Legend:
Removed from v.1.81  
changed lines
  Added in v.1.82