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

Diff for /src/usr.bin/tmux/status.c between version 1.19 and 1.20

version 1.19, 2009/07/27 18:51:46 version 1.20, 2009/07/27 19:29:35
Line 589 
Line 589 
     int (*callbackfn)(void *, const char *), void (*freefn)(void *),      int (*callbackfn)(void *, const char *), void (*freefn)(void *),
     void *data, int flags)      void *data, int flags)
 {  {
           int     keys;
   
         status_message_clear(c);          status_message_clear(c);
         status_prompt_clear(c);          status_prompt_clear(c);
   
Line 605 
Line 607 
   
         c->prompt_flags = flags;          c->prompt_flags = flags;
   
         mode_key_init(&c->prompt_mdata,          keys = options_get_number(&c->session->options, "status-keys");
             options_get_number(&c->session->options, "status-keys"),          if (keys == MODEKEY_EMACS)
             MODEKEY_CANEDIT);                  mode_key_init(&c->prompt_mdata, mode_key_emacs_edit);
           else
                   mode_key_init(&c->prompt_mdata, mode_key_vi_edit);
   
         c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);          c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);
         c->flags |= CLIENT_STATUS;          c->flags |= CLIENT_STATUS;
Line 727 
Line 731 
   
         size = strlen(c->prompt_buffer);          size = strlen(c->prompt_buffer);
         switch (mode_key_lookup(&c->prompt_mdata, key)) {          switch (mode_key_lookup(&c->prompt_mdata, key)) {
         case MODEKEYCMD_LEFT:          case MODEKEYEDIT_CURSORLEFT:
                 if (c->prompt_index > 0) {                  if (c->prompt_index > 0) {
                         c->prompt_index--;                          c->prompt_index--;
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_RIGHT:          case MODEKEYEDIT_SWITCHMODEAPPEND:
           case MODEKEYEDIT_CURSORRIGHT:
                 if (c->prompt_index < size) {                  if (c->prompt_index < size) {
                         c->prompt_index++;                          c->prompt_index++;
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_STARTOFLINE:          case MODEKEYEDIT_STARTOFLINE:
         case MODEKEYCMD_BACKTOINDENTATION:  
                 if (c->prompt_index != 0) {                  if (c->prompt_index != 0) {
                         c->prompt_index = 0;                          c->prompt_index = 0;
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_ENDOFLINE:          case MODEKEYEDIT_ENDOFLINE:
                 if (c->prompt_index != size) {                  if (c->prompt_index != size) {
                         c->prompt_index = size;                          c->prompt_index = size;
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_COMPLETE:          case MODEKEYEDIT_COMPLETE:
                 if (*c->prompt_buffer == '\0')                  if (*c->prompt_buffer == '\0')
                         break;                          break;
   
Line 800 
Line 804 
   
                 c->flags |= CLIENT_STATUS;                  c->flags |= CLIENT_STATUS;
                 break;                  break;
         case MODEKEYCMD_BACKSPACE:          case MODEKEYEDIT_BACKSPACE:
                 if (c->prompt_index != 0) {                  if (c->prompt_index != 0) {
                         if (c->prompt_index == size)                          if (c->prompt_index == size)
                                 c->prompt_buffer[--c->prompt_index] = '\0';                                  c->prompt_buffer[--c->prompt_index] = '\0';
Line 813 
Line 817 
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_DELETE:          case MODEKEYEDIT_DELETE:
                 if (c->prompt_index != size) {                  if (c->prompt_index != size) {
                         memmove(c->prompt_buffer + c->prompt_index,                          memmove(c->prompt_buffer + c->prompt_index,
                             c->prompt_buffer + c->prompt_index + 1,                              c->prompt_buffer + c->prompt_index + 1,
Line 821 
Line 825 
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_DELETETOENDOFLINE:          case MODEKEYEDIT_DELETETOENDOFLINE:
                 if (c->prompt_index < size) {                  if (c->prompt_index < size) {
                         c->prompt_buffer[c->prompt_index] = '\0';                          c->prompt_buffer[c->prompt_index] = '\0';
                         c->flags |= CLIENT_STATUS;                          c->flags |= CLIENT_STATUS;
                 }                  }
                 break;                  break;
         case MODEKEYCMD_UP:          case MODEKEYEDIT_HISTORYUP:
                 if (server_locked)                  if (server_locked)
                         break;                          break;
   
Line 845 
Line 849 
                 c->prompt_index = strlen(c->prompt_buffer);                  c->prompt_index = strlen(c->prompt_buffer);
                 c->flags |= CLIENT_STATUS;                  c->flags |= CLIENT_STATUS;
                 break;                  break;
         case MODEKEYCMD_DOWN:          case MODEKEYEDIT_HISTORYDOWN:
                 if (server_locked)                  if (server_locked)
                         break;                          break;
   
Line 864 
Line 868 
                 c->prompt_index = strlen(c->prompt_buffer);                  c->prompt_index = strlen(c->prompt_buffer);
                 c->flags |= CLIENT_STATUS;                  c->flags |= CLIENT_STATUS;
                 break;                  break;
         case MODEKEYCMD_PASTE:          case MODEKEYEDIT_PASTE:
                 if ((pb = paste_get_top(&c->session->buffers)) == NULL)                  if ((pb = paste_get_top(&c->session->buffers)) == NULL)
                         break;                          break;
                 if ((last = strchr(pb->data, '\n')) == NULL)                  if ((last = strchr(pb->data, '\n')) == NULL)
Line 886 
Line 890 
   
                 c->flags |= CLIENT_STATUS;                  c->flags |= CLIENT_STATUS;
                 break;                  break;
         case MODEKEYCMD_CHOOSE:          case MODEKEYEDIT_ENTER:
                 if (*c->prompt_buffer != '\0') {                  if (*c->prompt_buffer != '\0') {
                         status_prompt_add_history(c);                          status_prompt_add_history(c);
                         if (c->prompt_callbackfn(                          if (c->prompt_callbackfn(
Line 895 
Line 899 
                         break;                          break;
                 }                  }
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case MODEKEYCMD_QUIT:          case MODEKEYEDIT_CANCEL:
                 if (c->prompt_callbackfn(c->prompt_data, NULL) == 0)                  if (c->prompt_callbackfn(c->prompt_data, NULL) == 0)
                         status_prompt_clear(c);                          status_prompt_clear(c);
                 break;                  break;
         case MODEKEYCMD_OTHERKEY:          case MODEKEY_OTHER:
                 if (key < 32 || key > 126)                  if (key < 32 || key > 126)
                         break;                          break;
                 c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + 2);                  c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + 2);

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20