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..b193748 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,27 +59,32 @@ 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;
+       } 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;
-- 
1.8.1


------------------------------------------------------------------------------
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