The branch, master has been updated
       via  b2a61348ddd2dbe91c6b656ef7ddd64a535e0b20 (commit)
       via  234f6d27c17de09e0dcdb3eb224ab0821ab17993 (commit)
      from  f339cfd31563aaae0ae94361228bb697c83aa3bf (commit)

- Log -----------------------------------------------------------------
commit b2a61348ddd2dbe91c6b656ef7ddd64a535e0b20
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Add -a to capture-pane to capture alternate screen, from George Nachman.
---
 cmd-capture-pane.c |   28 ++++++++++++++++++++--------
 tmux.1             |    6 ++++--
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index cd899dd..a676714 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -31,8 +31,8 @@ enum cmd_retval        cmd_capture_pane_exec(struct cmd *, 
struct cmd_q *);
 
 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]"
+       "ab:CeE:JpS:t:", 0, 0,
+       "[-aCeJp] [-b buffer-index] [-E end-line] [-S start-line]"
        CMD_TARGET_PANE_USAGE,
        0,
        NULL,
@@ -50,15 +50,27 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
        struct screen           *s;
        struct grid             *gd;
        int                      buffer, n, with_codes, escape_c0, join_lines;
-       u_int                    i, limit, top, bottom, tmp;
+       u_int                    i, limit, top, bottom, tmp, sx;
        size_t                   len, linelen;
        struct grid_cell        *gc;
        const struct grid_line  *gl;
 
        if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
                return (CMD_RETURN_ERROR);
-       s = &wp->base;
-       gd = s->grid;
+
+       if (args_has(args, 'a')) {
+               s = NULL;
+               gd = wp->saved_grid;
+               sx = screen_size_x(&wp->base);
+               if (gd == NULL) {
+                       cmdq_error(cmdq, "no alternate screen");
+                       return (CMD_RETURN_ERROR);
+               }
+       } else {
+               s = &wp->base;
+               sx = screen_size_x(s);
+               gd = s->grid;
+       }
 
        buf = NULL;
        len = 0;
@@ -97,15 +109,15 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
 
        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);
+               line = grid_string_cells(gd, 0, i, sx, &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);
+               gl = grid_peek_line(gd, i);
                if (!join_lines || !(gl->flags & GRID_LINE_WRAPPED))
                        buf[len++] = '\n';
 
diff --git a/tmux.1 b/tmux.1
index 8e536b6..6087700 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1066,8 +1066,7 @@ By default, it uses the format
 but a different format may be specified with
 .Fl F .
 .It Xo Ic capture-pane
-.Op Fl e
-.Op Fl p
+.Op Fl aep
 .Op Fl b Ar buffer-index
 .Op Fl E Ar end-line
 .Op Fl S Ar start-line
@@ -1081,6 +1080,9 @@ is given, the output goes to stdout, otherwise to the 
buffer specified with
 .Fl b
 or a new buffer if omitted.
 If
+.Fl a
+is given, the alternate screen is used, and the history is not accessible.
+If
 .Fl e
 is given, the output includes escape sequences for text and background
 attributes.


commit 234f6d27c17de09e0dcdb3eb224ab0821ab17993
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Use \\ not \ for escaping \.
---
 grid.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/grid.c b/grid.c
index d416414..1624b2d 100644
--- a/grid.c
+++ b/grid.c
@@ -621,7 +621,7 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, 
u_int nx,
                data = ud.data;
                size = ud.size;
                if (escape_c0 && size == 1 && *data == '\\') {
-                       data = "\\";
+                       data = "\\\\";
                        size = 2;
                }
 


-----------------------------------------------------------------------

Summary of changes:
 cmd-capture-pane.c |   28 ++++++++++++++++++++--------
 grid.c             |    2 +-
 tmux.1             |    6 ++++--
 3 files changed, 25 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to