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

Diff for /src/usr.bin/tmux/input.c between version 1.66 and 1.67

version 1.66, 2014/03/31 21:32:00 version 1.67, 2014/04/17 12:43:38
Line 55 
Line 55 
   
 /* Transition entry/exit handlers. */  /* Transition entry/exit handlers. */
 void    input_clear(struct input_ctx *);  void    input_clear(struct input_ctx *);
   void    input_ground(struct input_ctx *);
 void    input_enter_osc(struct input_ctx *);  void    input_enter_osc(struct input_ctx *);
 void    input_exit_osc(struct input_ctx *);  void    input_exit_osc(struct input_ctx *);
 void    input_enter_apc(struct input_ctx *);  void    input_enter_apc(struct input_ctx *);
Line 242 
Line 243 
 /* ground state definition. */  /* ground state definition. */
 const struct input_state input_state_ground = {  const struct input_state input_state_ground = {
         "ground",          "ground",
         NULL, NULL,          input_ground, NULL,
         input_state_ground_table          input_state_ground_table
 };  };
   
Line 701 
Line 702 
         *ictx->param_buf = '\0';          *ictx->param_buf = '\0';
         ictx->param_len = 0;          ictx->param_len = 0;
   
           ictx->input_space = INPUT_BUF_START;
           ictx->input_buf = xmalloc(INPUT_BUF_START);
   
           *ictx->input_buf = '\0';
           ictx->input_len = 0;
   
         ictx->state = &input_state_ground;          ictx->state = &input_state_ground;
         ictx->flags = 0;          ictx->flags = 0;
   
Line 711 
Line 718 
 void  void
 input_free(struct window_pane *wp)  input_free(struct window_pane *wp)
 {  {
         if (wp != NULL)          if (wp == NULL)
                 evbuffer_free(wp->ictx.since_ground);                  return;
   
           free(wp->ictx.input_buf);
           evbuffer_free(wp->ictx.since_ground);
 }  }
   
 /* Change input state. */  /* Change input state. */
Line 720 
Line 730 
 input_set_state(struct window_pane *wp, const struct input_transition *itr)  input_set_state(struct window_pane *wp, const struct input_transition *itr)
 {  {
         struct input_ctx        *ictx = &wp->ictx;          struct input_ctx        *ictx = &wp->ictx;
         struct evbuffer         *ground_evb = ictx->since_ground;  
   
         if (ictx->state->exit != NULL)          if (ictx->state->exit != NULL)
                 ictx->state->exit(ictx);                  ictx->state->exit(ictx);
   
         if (itr->state == &input_state_ground)  
                 evbuffer_drain(ground_evb, EVBUFFER_LENGTH(ground_evb));  
   
         ictx->state = itr->state;          ictx->state = itr->state;
         if (ictx->state->enter != NULL)          if (ictx->state->enter != NULL)
                 ictx->state->enter(ictx);                  ictx->state->enter(ictx);
Line 882 
Line 887 
         ictx->flags &= ~INPUT_DISCARD;          ictx->flags &= ~INPUT_DISCARD;
 }  }
   
   /* Reset for ground state. */
   void
   input_ground(struct input_ctx *ictx)
   {
           evbuffer_drain(ictx->since_ground, EVBUFFER_LENGTH(ictx->since_ground));
   
           if (ictx->input_space > INPUT_BUF_START) {
                   ictx->input_space = INPUT_BUF_START;
                   ictx->input_buf = xrealloc(ictx->input_buf, 1, INPUT_BUF_START);
           }
   }
   
 /* Output this character to the screen. */  /* Output this character to the screen. */
 int  int
 input_print(struct input_ctx *ictx)  input_print(struct input_ctx *ictx)
Line 924 
Line 941 
 int  int
 input_input(struct input_ctx *ictx)  input_input(struct input_ctx *ictx)
 {  {
         if (ictx->input_len == (sizeof ictx->input_buf) - 1)          size_t available;
                 ictx->flags |= INPUT_DISCARD;  
         else {          available = ictx->input_space;
                 ictx->input_buf[ictx->input_len++] = ictx->ch;          while (ictx->input_len + 1 >= available) {
                 ictx->input_buf[ictx->input_len] = '\0';                  available *= 2;
                   if (available > INPUT_BUF_LIMIT) {
                           ictx->flags |= INPUT_DISCARD;
                           return (0);
                   }
                   ictx->input_buf = xrealloc(ictx->input_buf, 1, available);
                   ictx->input_space = available;
         }          }
           ictx->input_buf[ictx->input_len++] = ictx->ch;
           ictx->input_buf[ictx->input_len] = '\0';
   
         return (0);          return (0);
 }  }
Line 1666 
Line 1691 
 void  void
 input_exit_osc(struct input_ctx *ictx)  input_exit_osc(struct input_ctx *ictx)
 {  {
         u_char *p = ictx->input_buf;          u_char  *p = ictx->input_buf;
         int     option;          int      option;
   
         if (ictx->flags & INPUT_DISCARD)          if (ictx->flags & INPUT_DISCARD)
                 return;                  return;

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67