[BACK]Return to cmd-capture-pane.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/cmd-capture-pane.c between version 1.20 and 1.21

version 1.20, 2013/03/25 10:02:17 version 1.21, 2013/03/25 10:04:04
Line 31 
Line 31 
   
 const struct cmd_entry cmd_capture_pane_entry = {  const struct cmd_entry cmd_capture_pane_entry = {
         "capture-pane", "capturep",          "capture-pane", "capturep",
         "ab:CeE:JpS:t:", 0, 0,          "ab:CeE:JpqS:t:", 0, 0,
         "[-aCeJp] [-b buffer-index] [-E end-line] [-S start-line]"          "[-aCeJpq] [-b buffer-index] [-E end-line] [-S start-line]"
         CMD_TARGET_PANE_USAGE,          CMD_TARGET_PANE_USAGE,
         0,          0,
         NULL,          NULL,
Line 62 
Line 62 
                 s = NULL;                  s = NULL;
                 gd = wp->saved_grid;                  gd = wp->saved_grid;
                 sx = screen_size_x(&wp->base);                  sx = screen_size_x(&wp->base);
                 if (gd == NULL) {                  if (gd == NULL && !args_has(args, 'q')) {
                         cmdq_error(cmdq, "no alternate screen");                          cmdq_error(cmdq, "no alternate screen");
                         return (CMD_RETURN_ERROR);                          return (CMD_RETURN_ERROR);
                 }                  }
Line 75 
Line 75 
         buf = NULL;          buf = NULL;
         len = 0;          len = 0;
   
         n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);          if (gd != NULL) {
         if (cause != NULL) {                  n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
                 top = gd->hsize;                  if (cause != NULL) {
                 free(cause);                          top = gd->hsize;
         } else if (n < 0 && (u_int) -n > gd->hsize)                          free(cause);
                 top = 0;                  } else if (n < 0 && (u_int) -n > gd->hsize)
         else                          top = 0;
                 top = gd->hsize + n;                  else
         if (top > gd->hsize + gd->sy - 1)                          top = gd->hsize + n;
                 top = gd->hsize + gd->sy - 1;                  if (top > gd->hsize + gd->sy - 1)
                           top = gd->hsize + gd->sy - 1;
   
         n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);                  n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
         if (cause != NULL) {                  if (cause != NULL) {
                 bottom = gd->hsize + gd->sy - 1;                          bottom = gd->hsize + gd->sy - 1;
                 free(cause);                          free(cause);
         } else if (n < 0 && (u_int) -n > gd->hsize)                  } else if (n < 0 && (u_int) -n > gd->hsize)
                 bottom = 0;                          bottom = 0;
         else                  else
                 bottom = gd->hsize + n;                          bottom = gd->hsize + n;
         if (bottom > gd->hsize + gd->sy - 1)                  if (bottom > gd->hsize + gd->sy - 1)
                 bottom = gd->hsize + gd->sy - 1;                          bottom = gd->hsize + gd->sy - 1;
   
         if (bottom < top) {                  if (bottom < top) {
                 tmp = bottom;                          tmp = bottom;
                 bottom = top;                          bottom = top;
                 top = tmp;                          top = tmp;
         }                  }
   
         with_codes = args_has(args, 'e');                  with_codes = args_has(args, 'e');
         escape_c0 = args_has(args, 'C');                  escape_c0 = args_has(args, 'C');
         join_lines = args_has(args, 'J');                  join_lines = args_has(args, 'J');
   
         gc = NULL;                  gc = NULL;
         for (i = top; i <= bottom; i++) {                  for (i = top; i <= bottom; i++) {
                 line = grid_string_cells(gd, 0, i, sx, &gc, with_codes,                          line = grid_string_cells(gd, 0, i, sx, &gc, with_codes,
                     escape_c0);                              escape_c0);
                 linelen = strlen(line);                          linelen = strlen(line);
   
                 buf = xrealloc(buf, 1, len + linelen + 1);                          buf = xrealloc(buf, 1, len + linelen + 1);
                 memcpy(buf + len, line, linelen);                          memcpy(buf + len, line, linelen);
                 len += linelen;                          len += linelen;
   
                 gl = grid_peek_line(gd, i);                          gl = grid_peek_line(gd, i);
                 if (!join_lines || !(gl->flags & GRID_LINE_WRAPPED))                          if (!join_lines || !(gl->flags & GRID_LINE_WRAPPED))
                         buf[len++] = '\n';                                  buf[len++] = '\n';
   
                 free(line);                          free(line);
         }                  }
           } else
                   buf = xstrdup("");
   
         if (args_has(args, 'p')) {          if (args_has(args, 'p')) {
                 c = cmdq->client;                  c = cmdq->client;

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