[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.12 and 1.13

version 1.12, 2009/10/26 17:59:46 version 1.13, 2009/11/04 21:47:42
Line 299 
Line 299 
         struct tty_key  *tk;          struct tty_key  *tk;
         struct timeval   tv;          struct timeval   tv;
         char            *buf;          char            *buf;
           u_char           ch;
         size_t           len, size;          size_t           len, size;
         cc_t             bspace;          cc_t             bspace;
   
         buf = BUFFER_OUT(tty->in);          buf = EVBUFFER_DATA(tty->event->input);
         len = BUFFER_USED(tty->in);          len = EVBUFFER_LENGTH(tty->event->input);
         if (len == 0)          if (len == 0)
                 return (1);                  return (1);
         log_debug("keys are %zu (%.*s)", len, (int) len, buf);          log_debug("keys are %zu (%.*s)", len, (int) len, buf);
   
         /* If a normal key, return it. */          /* If a normal key, return it. */
         if (*buf != '\033') {          if (*buf != '\033') {
                 *key = buffer_read8(tty->in);                  bufferevent_read(tty->event, &ch, 1);
                   *key = ch;
   
                 /*                  /*
                  * Check for backspace key using termios VERASE - the terminfo                   * Check for backspace key using termios VERASE - the terminfo
Line 326 
Line 328 
         /* Look for matching key string and return if found. */          /* Look for matching key string and return if found. */
         tk = tty_keys_find(tty, buf + 1, len - 1, &size);          tk = tty_keys_find(tty, buf + 1, len - 1, &size);
         if (tk != NULL) {          if (tk != NULL) {
                 buffer_remove(tty->in, size + 1);                  evbuffer_drain(tty->event->input, size + 1);
                 *key = tk->key;                  *key = tk->key;
                 goto found;                  goto found;
         }          }
Line 334 
Line 336 
         /* Not found. Is this a mouse key press? */          /* Not found. Is this a mouse key press? */
         *key = tty_keys_mouse(buf, len, &size, mouse);          *key = tty_keys_mouse(buf, len, &size, mouse);
         if (*key != KEYC_NONE) {          if (*key != KEYC_NONE) {
                 buffer_remove(tty->in, size);                  evbuffer_drain(tty->event->input, size);
                 goto found;                  goto found;
         }          }
   
         /* Not found. Try to parse a key with an xterm-style modifier. */          /* Not found. Try to parse a key with an xterm-style modifier. */
         *key = xterm_keys_find(buf, len, &size);          *key = xterm_keys_find(buf, len, &size);
         if (*key != KEYC_NONE) {          if (*key != KEYC_NONE) {
                 buffer_remove(tty->in, size);                  evbuffer_drain(tty->event->input, size);
                 goto found;                  goto found;
         }          }
   
Line 363 
Line 365 
   
         /* Is there a normal key following? */          /* Is there a normal key following? */
         if (len != 0 && *buf != '\033') {          if (len != 0 && *buf != '\033') {
                 buffer_remove(tty->in, 1);                  evbuffer_drain(tty->event->input, 1);
                 *key = buffer_read8(tty->in) | KEYC_ESCAPE;                  bufferevent_read(tty->event, &ch, 1);
                   *key = ch | KEYC_ESCAPE;
                 goto found;                  goto found;
         }          }
   
Line 372 
Line 375 
         if (len > 1) {          if (len > 1) {
                 tk = tty_keys_find(tty, buf + 1, len - 1, &size);                  tk = tty_keys_find(tty, buf + 1, len - 1, &size);
                 if (tk != NULL) {                  if (tk != NULL) {
                         buffer_remove(tty->in, size + 2);                          evbuffer_drain(tty->event->input, size + 2);
                         *key = tk->key | KEYC_ESCAPE;                          *key = tk->key | KEYC_ESCAPE;
                         goto found;                          goto found;
                 }                  }
Line 385 
Line 388 
                 return (1);                  return (1);
   
         /* Give up and return the escape. */          /* Give up and return the escape. */
         buffer_remove(tty->in, 1);          evbuffer_drain(tty->event->input, 1);
         *key = '\033';          *key = '\033';
   
 found:  found:

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13