=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-capture-pane.c,v retrieving revision 1.17 retrieving revision 1.18 diff -c -r1.17 -r1.18 *** src/usr.bin/tmux/cmd-capture-pane.c 2013/03/22 15:53:24 1.17 --- src/usr.bin/tmux/cmd-capture-pane.c 2013/03/22 15:56:11 1.18 *************** *** 1,4 **** ! /* $OpenBSD: cmd-capture-pane.c,v 1.17 2013/03/22 15:53:24 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado --- 1,4 ---- ! /* $OpenBSD: cmd-capture-pane.c,v 1.18 2013/03/22 15:56:11 nicm Exp $ */ /* * Copyright (c) 2009 Jonathan Alvarado *************** *** 31,38 **** const struct cmd_entry cmd_capture_pane_entry = { "capture-pane", "capturep", ! "eb:E:pS:t:", 0, 0, ! "[-ep] [-b buffer-index] [-E end-line] [-S start-line]" CMD_TARGET_PANE_USAGE, 0, NULL, --- 31,38 ---- const struct cmd_entry cmd_capture_pane_entry = { "capture-pane", "capturep", ! "b:CeE:JpS:t:", 0, 0, ! "[-CeJp] [-b buffer-index] [-E end-line] [-S start-line]" CMD_TARGET_PANE_USAGE, 0, NULL, *************** *** 49,58 **** char *buf, *line, *cause; struct screen *s; struct grid *gd; ! int buffer, n, with_codes; u_int i, limit, top, bottom, tmp; size_t len, linelen; struct grid_cell *gc; if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL) return (CMD_RETURN_ERROR); --- 49,59 ---- char *buf, *line, *cause; struct screen *s; struct grid *gd; ! int buffer, n, with_codes, escape_c0, join_lines; u_int i, limit, top, bottom, tmp; size_t len, linelen; struct grid_cell *gc; + const struct grid_line *gl; if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL) return (CMD_RETURN_ERROR); *************** *** 90,106 **** top = tmp; } - gc = NULL; with_codes = args_has(args, 'e'); for (i = top; i <= bottom; i++) { line = grid_string_cells(s->grid, 0, i, screen_size_x(s), ! &gc, with_codes); linelen = strlen(line); buf = xrealloc(buf, 1, len + linelen + 1); memcpy(buf + len, line, linelen); len += linelen; ! buf[len++] = '\n'; free(line); } --- 91,113 ---- top = tmp; } with_codes = args_has(args, 'e'); + escape_c0 = args_has(args, 'C'); + join_lines = args_has(args, 'J'); + + gc = NULL; for (i = top; i <= bottom; i++) { line = grid_string_cells(s->grid, 0, i, screen_size_x(s), ! &gc, with_codes, escape_c0); linelen = strlen(line); buf = xrealloc(buf, 1, len + linelen + 1); memcpy(buf + len, line, linelen); len += linelen; ! ! gl = grid_peek_line(s->grid, i); ! if (!join_lines || !(gl->flags & GRID_LINE_WRAPPED)) ! buf[len++] = '\n'; free(line); }