Hi,

This patch had a slight editing error. Corrected it. (patch will be in the reply to this.)

* On Sat, Dec 15, 2012 at 05:32:16AM +0530, Raghavendra D Prabhu 
<raghu.prabh...@gmail.com> wrote:
Adds a '-h' option to capture the entire pane without providing the appropriate
co-ordinates.

Signed-off-by: Raghavendra D Prabhu <rpra...@wnohang.net>

diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index a94c717..11c4367 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_ctx *);

const struct cmd_entry cmd_capture_pane_entry = {
        "capture-pane", "capturep",
-       "b:E:S:t:", 0, 0,
-       "[-b buffer-index] [-E end-line] [-S start-line] [-t target-pane]",
+       "b:E:S:t:h", 0, 0,
+       "[-b buffer-index] [-E end-line] [-S start-line] [-t target-pane] [-h 
]",
        0,
        NULL,
        NULL,
@@ -59,44 +59,49 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
        buf = NULL;
        len = 0;

-       n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
-       if (cause != NULL) {
-               top = gd->hsize;
-               free(cause);
-       } else if (n < 0 && (u_int) -n > gd->hsize)
+       if (args_has(args, 'h')) {
                top = 0;
-       else
-               top = gd->hsize + n;
-       if (top > gd->hsize + gd->sy - 1)
-               top = gd->hsize + gd->sy - 1;
-
-       n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
-       if (cause != NULL) {
-               bottom = gd->hsize + gd->sy - 1;
-               free(cause);
-       } else if (n < 0 && (u_int) -n > gd->hsize)
-               bottom = 0;
-       else
-               bottom = gd->hsize + n;
-       if (bottom > gd->hsize + gd->sy - 1)
                bottom = gd->hsize + gd->sy - 1;
-
-       if (bottom < top) {
-               tmp = bottom;
-               bottom = top;
-               top = tmp;
-       }
-
-       for (i = top; i <= bottom; i++) {
-              line = grid_string_cells(s->grid, 0, i, screen_size_x(s));
-              linelen = strlen(line);
-
-              buf = xrealloc(buf, 1, len + linelen + 1);
-              memcpy(buf + len, line, linelen);
-              len += linelen;
-              buf[len++] = '\n';
-
-              free(line);
+       } else {
+               n = args_strtonum(args, 'S', INT_MIN, SHRT_MAX, &cause);
+               if (cause != NULL) {
+                       top = gd->hsize;
+                       free(cause);
+               } else if (n < 0 && (u_int) -n > gd->hsize)
+                       top = 0;
+               else
+                       top = gd->hsize + n;
+               if (top > gd->hsize + gd->sy - 1)
+                       top = gd->hsize + gd->sy - 1;
+
+               n = args_strtonum(args, 'E', INT_MIN, SHRT_MAX, &cause);
+               if (cause != NULL) {
+                       bottom = gd->hsize + gd->sy - 1;
+                       free(cause);
+               } else if (n < 0 && (u_int) -n > gd->hsize)
+                       bottom = 0;
+               else
+                       bottom = gd->hsize + n;
+               if (bottom > gd->hsize + gd->sy - 1)
+                       bottom = gd->hsize + gd->sy - 1;
+
+               if (bottom < top) {
+                       tmp = bottom;
+                       bottom = top;
+                       top = tmp;
+               }
+
+               for (i = top; i <= bottom; i++) {
+               line = grid_string_cells(s->grid, 0, i, screen_size_x(s));
+               linelen = strlen(line);
+
+               buf = xrealloc(buf, 1, len + linelen + 1);
+               memcpy(buf + len, line, linelen);
+               len += linelen;
+               buf[len++] = '\n';
+
+               free(line);
+               }
        }

        limit = options_get_number(&global_options, "buffer-limit");
--
1.8.0.2





Regards,
--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net

Attachment: pgpR73qR7AGuU.pgp
Description: PGP signature

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to