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

Diff for /src/usr.bin/tmux/input-keys.c between version 1.7 and 1.8

version 1.7, 2009/10/26 13:22:30 version 1.8, 2009/10/26 13:29:24
Line 24 
Line 24 
   
 #include "tmux.h"  #include "tmux.h"
   
   /*
    * This file is rather misleadingly named, it contains the code which takes a
    * key code and translates it into something suitable to be sent to the
    * application running in a pane (similar to input.c does in the other
    * direction with output).
    */
   
 struct input_key_ent {  struct input_key_ent {
         int              key;          int              key;
         const char      *data;          const char      *data;
Line 88 
Line 95 
         { KEYC_RIGHT,           "\033[C",       0 },          { KEYC_RIGHT,           "\033[C",       0 },
         { KEYC_LEFT,            "\033[D",       0 },          { KEYC_LEFT,            "\033[D",       0 },
   
         /* Keypad keys. Keypad versions must come first.*/          /* Keypad keys. Keypad versions must come first. */
         { KEYC_KP_SLASH,        "/",            INPUTKEY_KEYPAD },          { KEYC_KP_SLASH,        "/",            INPUTKEY_KEYPAD },
         { KEYC_KP_STAR,         "*",            INPUTKEY_KEYPAD },          { KEYC_KP_STAR,         "*",            INPUTKEY_KEYPAD },
         { KEYC_KP_MINUS,        "-",            INPUTKEY_KEYPAD },          { KEYC_KP_MINUS,        "-",            INPUTKEY_KEYPAD },
Line 124 
Line 131 
         { KEYC_KP_PERIOD,       "\033On",       0 },          { KEYC_KP_PERIOD,       "\033On",       0 },
 };  };
   
 /* Translate a key code from client into an output key sequence. */  /* Translate a key code into an output key sequence. */
 void  void
 input_key(struct window_pane *wp, int key)  input_key(struct window_pane *wp, int key)
 {  {
         struct input_key_ent   *ike;          struct input_key_ent   *ike;
         u_int                   i;          u_int                   i;
         char                    ch;  
         size_t                  dlen;          size_t                  dlen;
         int                     xterm_keys;  
   
         log_debug2("writing key 0x%x", key);          log_debug2("writing key 0x%x", key);
   
           /*
            * If this is a normal 7-bit key, just send it, with a leading escape
            * if necessary.
            */
         if (key != KEYC_NONE && (key & ~KEYC_ESCAPE) < 0x100) {          if (key != KEYC_NONE && (key & ~KEYC_ESCAPE) < 0x100) {
                 if (key & KEYC_ESCAPE)                  if (key & KEYC_ESCAPE)
                         buffer_write8(wp->out, '\033');                          buffer_write8(wp->out, '\033');
Line 143 
Line 152 
                 return;                  return;
         }          }
   
           /* Otherwise look the key up in the table. */
         for (i = 0; i < nitems(input_keys); i++) {          for (i = 0; i < nitems(input_keys); i++) {
                 ike = &input_keys[i];                  ike = &input_keys[i];
   
Line 172 
Line 182 
   
         log_debug2("found key 0x%x: \"%s\"", key, ike->data);          log_debug2("found key 0x%x: \"%s\"", key, ike->data);
   
         /*          /* Prefix a \033 for escape and set bit 5 of the last byte for ctrl. */
          * Not in xterm mode. Prefix a \033 for escape, and set bit 5 of the  
          * last byte for ctrl.  
          */  
         if (key & KEYC_ESCAPE)          if (key & KEYC_ESCAPE)
                 buffer_write8(wp->out, '\033');                  buffer_write8(wp->out, '\033');
         if (key & KEYC_CTRL && ike->flags & INPUTKEY_CTRL) {          if (key & KEYC_CTRL && ike->flags & INPUTKEY_CTRL) {
Line 186 
Line 193 
         buffer_write(wp->out, ike->data, dlen);          buffer_write(wp->out, ike->data, dlen);
 }  }
   
 /* Handle input mouse. */  /* Translate mouse and output. */
 void  void
 input_mouse(struct window_pane *wp, struct mouse_event *m)  input_mouse(struct window_pane *wp, struct mouse_event *m)
 {  {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8