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

Diff for /src/usr.bin/tmux/window-copy.c between version 1.47 and 1.48

version 1.47, 2010/02/22 20:28:21 version 1.48, 2010/02/22 20:41:16
Line 226 
Line 226 
 void  void
 window_copy_key(struct window_pane *wp, struct client *c, int key)  window_copy_key(struct window_pane *wp, struct client *c, int key)
 {  {
         const char                      *word_separators = " -_@";          const char                      *word_separators;
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *s = &data->screen;          struct screen                   *s = &data->screen;
         u_int                            n;          u_int                            n;
Line 356 
Line 356 
                 window_copy_cursor_next_word_end(wp, " ");                  window_copy_cursor_next_word_end(wp, " ");
                 break;                  break;
         case MODEKEYCOPY_NEXTWORD:          case MODEKEYCOPY_NEXTWORD:
                   word_separators =
                       options_get_string(&wp->window->options, "word-separators");
                 window_copy_cursor_next_word(wp, word_separators);                  window_copy_cursor_next_word(wp, word_separators);
                 break;                  break;
         case MODEKEYCOPY_NEXTWORDEND:          case MODEKEYCOPY_NEXTWORDEND:
                   word_separators =
                       options_get_string(&wp->window->options, "word-separators");
                 window_copy_cursor_next_word_end(wp, word_separators);                  window_copy_cursor_next_word_end(wp, word_separators);
                 break;                  break;
         case MODEKEYCOPY_PREVIOUSSPACE:          case MODEKEYCOPY_PREVIOUSSPACE:
                 window_copy_cursor_previous_word(wp, " ");                  window_copy_cursor_previous_word(wp, " ");
                 break;                  break;
         case MODEKEYCOPY_PREVIOUSWORD:          case MODEKEYCOPY_PREVIOUSWORD:
                   word_separators =
                       options_get_string(&wp->window->options, "word-separators");
                 window_copy_cursor_previous_word(wp, word_separators);                  window_copy_cursor_previous_word(wp, word_separators);
                 break;                  break;
         case MODEKEYCOPY_SEARCHUP:          case MODEKEYCOPY_SEARCHUP:
Line 1271 
Line 1277 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *base_s = &wp->base;          struct screen                   *base_s = &wp->base;
         u_int                            px, py, xx, yy;          u_int                            px, py, xx, yy;
           int                              expected = 0;
   
         px = data->cx;          px = data->cx;
         py = screen_hsize(base_s) + data->cy - data->oy;          py = screen_hsize(base_s) + data->cy - data->oy;
         xx = window_copy_find_length(wp, py);          xx = window_copy_find_length(wp, py);
         yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;          yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;
   
         /* Are we in a word? Skip it! */          /*
         while (!window_copy_in_set(wp, px, py, separators))           * First skip past any nonword characters and then any word characters.
                 px++;           *
            * expected is initially set to 0 for the former and then 1 for the
            * latter.
            */
           do {
                   while (px > xx ||
                       window_copy_in_set(wp, px, py, separators) == expected) {
                           /* Move down if we're past the end of the line. */
                           if (px > xx) {
                                   if (py == yy)
                                           return;
                                   window_copy_cursor_down(wp, 0);
                                   px = 0;
   
         /* Find the start of a word. */                                  py = screen_hsize(base_s) + data->cy - data->oy;
         while (px > xx || window_copy_in_set(wp, px, py, separators)) {                                  xx = window_copy_find_length(wp, py);
                 /* Past the end of the line? Nothing but spaces. */                          } else
                 if (px > xx) {                                  px++;
                         if (py == yy)                  }
                                 return;                  expected = !expected;
                         window_copy_cursor_down(wp, 0);          } while (expected == 1);
                         px = 0;  
   
                         py = screen_hsize(base_s) + data->cy - data->oy;  
                         xx = window_copy_find_length(wp, py);  
                 } else  
                         px++;  
         }  
   
         window_copy_update_cursor(wp, px, data->cy);          window_copy_update_cursor(wp, px, data->cy);
         if (window_copy_update_selection(wp))          if (window_copy_update_selection(wp))
                 window_copy_redraw_lines(wp, data->cy, 1);                  window_copy_redraw_lines(wp, data->cy, 1);
Line 1307 
Line 1319 
         struct window_copy_mode_data    *data = wp->modedata;          struct window_copy_mode_data    *data = wp->modedata;
         struct screen                   *base_s = &wp->base;          struct screen                   *base_s = &wp->base;
         u_int                            px, py, xx, yy;          u_int                            px, py, xx, yy;
           int                              expected = 1;
   
         px = data->cx;          px = data->cx;
         py = screen_hsize(base_s) + data->cy - data->oy;          py = screen_hsize(base_s) + data->cy - data->oy;
         xx = window_copy_find_length(wp, py);          xx = window_copy_find_length(wp, py);
         yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;          yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;
   
         /* Are we on spaces? Skip 'em! */          /*
         while (px > xx || window_copy_in_set(wp, px, py, separators)) {           * First skip past any word characters, then any nonword characters.
                 /* Nothing but spaces past the end of the line, so move down. */           *
                 if (px > xx) {           * expected is initially set to 1 for the former and then 0 for the
                         if (py == yy)           * latter.
                                 return;           */
                         window_copy_cursor_down(wp, 0);          do {
                         px = 0;                  while (px > xx ||
                       window_copy_in_set(wp, px, py, separators) == expected) {
                           /* Move down if we're past the end of the line. */
                           if (px > xx) {
                                   if (py == yy)
                                           return;
                                   window_copy_cursor_down(wp, 0);
                                   px = 0;
   
                         py = screen_hsize(base_s) + data->cy - data->oy;                                  py = screen_hsize(base_s) + data->cy - data->oy;
                         xx = window_copy_find_length(wp, py);                                  xx = window_copy_find_length(wp, py);
                 } else                          } else
                         px++;                                  px++;
         }                  }
                   expected = !expected;
         /* Find the end of this word. */          } while (expected == 0);
         while (!window_copy_in_set(wp, px, py, separators))  
                 px++;  
   
         window_copy_update_cursor(wp, px, data->cy);          window_copy_update_cursor(wp, px, data->cy);
         if (window_copy_update_selection(wp))          if (window_copy_update_selection(wp))

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48