mirror of
https://github.com/tmux/tmux.git
synced 2025-04-01 21:41:44 +00:00
Add -N to capture-pane to preserve trailing spaces, from Leon Winter.
This commit is contained in:
parent
58bbce09e2
commit
2db5f9c215
@ -39,8 +39,8 @@ const struct cmd_entry cmd_capture_pane_entry = {
|
|||||||
.name = "capture-pane",
|
.name = "capture-pane",
|
||||||
.alias = "capturep",
|
.alias = "capturep",
|
||||||
|
|
||||||
.args = { "ab:CeE:JpPqS:t:", 0, 0 },
|
.args = { "ab:CeE:JNpPqS:t:", 0, 0 },
|
||||||
.usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] "
|
.usage = "[-aCeJNpPq] " CMD_BUFFER_USAGE " [-E end-line] "
|
||||||
"[-S start-line] " CMD_TARGET_PANE_USAGE,
|
"[-S start-line] " CMD_TARGET_PANE_USAGE,
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
@ -110,7 +110,7 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
|
|||||||
struct grid *gd;
|
struct grid *gd;
|
||||||
const struct grid_line *gl;
|
const struct grid_line *gl;
|
||||||
struct grid_cell *gc = NULL;
|
struct grid_cell *gc = NULL;
|
||||||
int n, with_codes, escape_c0, join_lines;
|
int n, with_codes, escape_c0, join_lines, no_trim;
|
||||||
u_int i, sx, top, bottom, tmp;
|
u_int i, sx, top, bottom, tmp;
|
||||||
char *cause, *buf, *line;
|
char *cause, *buf, *line;
|
||||||
const char *Sflag, *Eflag;
|
const char *Sflag, *Eflag;
|
||||||
@ -170,11 +170,12 @@ cmd_capture_pane_history(struct args *args, struct cmdq_item *item,
|
|||||||
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');
|
||||||
|
no_trim = args_has(args, 'N');
|
||||||
|
|
||||||
buf = NULL;
|
buf = 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, !join_lines);
|
escape_c0, !join_lines && !no_trim);
|
||||||
linelen = strlen(line);
|
linelen = strlen(line);
|
||||||
|
|
||||||
buf = cmd_capture_pane_append(buf, len, line, linelen);
|
buf = cmd_capture_pane_append(buf, len, line, linelen);
|
||||||
|
6
tmux.1
6
tmux.1
@ -1642,7 +1642,7 @@ By default, it uses the format
|
|||||||
but a different format may be specified with
|
but a different format may be specified with
|
||||||
.Fl F .
|
.Fl F .
|
||||||
.It Xo Ic capture-pane
|
.It Xo Ic capture-pane
|
||||||
.Op Fl aepPqCJ
|
.Op Fl aepPqCJN
|
||||||
.Op Fl b Ar buffer-name
|
.Op Fl b Ar buffer-name
|
||||||
.Op Fl E Ar end-line
|
.Op Fl E Ar end-line
|
||||||
.Op Fl S Ar start-line
|
.Op Fl S Ar start-line
|
||||||
@ -1667,8 +1667,10 @@ is given, the output includes escape sequences for text and background
|
|||||||
attributes.
|
attributes.
|
||||||
.Fl C
|
.Fl C
|
||||||
also escapes non-printable characters as octal \exxx.
|
also escapes non-printable characters as octal \exxx.
|
||||||
|
.Fl N
|
||||||
|
preserves trailing spaces at each line's end and
|
||||||
.Fl J
|
.Fl J
|
||||||
joins wrapped lines and preserves trailing spaces at each line's end.
|
preserves trailing spaces and joins any wrapped lines.
|
||||||
.Fl P
|
.Fl P
|
||||||
captures only any output that the pane has received that is the beginning of an
|
captures only any output that the pane has received that is the beginning of an
|
||||||
as-yet incomplete escape sequence.
|
as-yet incomplete escape sequence.
|
||||||
|
Loading…
Reference in New Issue
Block a user