The branch, master has been updated
       via  1da64bf786d2f139b822bc80ef6043443c0ea720 (commit)
       via  1cb1fb5bd401cf26568a2dc480a8548af3b43930 (commit)
      from  208881a735669d854b132629eedb463ea9c01420 (commit)

- Log -----------------------------------------------------------------
commit 1da64bf786d2f139b822bc80ef6043443c0ea720
Author: Nicholas Marriott <[email protected]>
Commit: Nicholas Marriott <[email protected]>

    Remove some unused/unnecessary control notifications, from George Nachman.
---
 control-notify.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/control-notify.c b/control-notify.c
index 87a25bb..bb9708c 100644
--- a/control-notify.c
+++ b/control-notify.c
@@ -104,10 +104,7 @@ control_notify_window_unlinked(unused struct session *s, 
struct window *w)
                        continue;
                cs = c->session;
 
-               if (winlink_find_by_window_id(&cs->windows, w->id) != NULL)
-                       control_write(c, "%%window-close %u", w->id);
-               else
-                       control_write(c, "%%unlinked-window-close %u", w->id);
+               control_write(c, "%%window-close %u", w->id);
        }
 }
 
@@ -144,13 +141,7 @@ control_notify_window_renamed(struct window *w)
                        continue;
                s = c->session;
 
-               if (winlink_find_by_window_id(&s->windows, w->id) != NULL) {
-                       control_write(c, "%%window-renamed %u %s",
-                           w->id, w->name);
-               } else {
-                       control_write(c, "%%unlinked-window-renamed %u %s",
-                           w->id, w->name);
-               }
+                control_write(c, "%%window-renamed %u %s", w->id, w->name);
        }
 }
 


commit 1cb1fb5bd401cf26568a2dc480a8548af3b43930
Author: Nicholas Marriott <[email protected]>
Commit: Nicholas Marriott <[email protected]>

    Add -q flags to shut up errors to capture-pane and show-options, from George
    Nachman.
---
 cmd-capture-pane.c |   95 +++++++++++++++++++++++++++-------------------------
 cmd-show-options.c |   20 +++++++----
 tmux.1             |   12 +++++-
 3 files changed, 72 insertions(+), 55 deletions(-)

diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index a676714..118bf94 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",
-       "ab:CeE:JpS:t:", 0, 0,
-       "[-aCeJp] [-b buffer-index] [-E end-line] [-S start-line]"
+       "ab:CeE:JpqS:t:", 0, 0,
+       "[-aCeJpq] [-b buffer-index] [-E end-line] [-S start-line]"
        CMD_TARGET_PANE_USAGE,
        0,
        NULL,
@@ -62,7 +62,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
                s = NULL;
                gd = wp->saved_grid;
                sx = screen_size_x(&wp->base);
-               if (gd == NULL) {
+               if (gd == NULL && !args_has(args, 'q')) {
                        cmdq_error(cmdq, "no alternate screen");
                        return (CMD_RETURN_ERROR);
                }
@@ -75,54 +75,57 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
        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)
-               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;
-       }
+       if (gd != NULL) {
+               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;
+               }
 
-       with_codes = args_has(args, 'e');
-       escape_c0 = args_has(args, 'C');
-       join_lines = args_has(args, 'J');
+               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(gd, 0, i, sx, &gc, with_codes,
-                   escape_c0);
-               linelen = strlen(line);
+               gc = NULL;
+               for (i = top; i <= bottom; i++) {
+                       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;
+                       buf = xrealloc(buf, 1, len + linelen + 1);
+                       memcpy(buf + len, line, linelen);
+                       len += linelen;
 
-               gl = grid_peek_line(gd, i);
-               if (!join_lines || !(gl->flags & GRID_LINE_WRAPPED))
-                       buf[len++] = '\n';
+                       gl = grid_peek_line(gd, i);
+                       if (!join_lines || !(gl->flags & GRID_LINE_WRAPPED))
+                               buf[len++] = '\n';
 
-               free(line);
-       }
+                       free(line);
+               }
+       } else
+               buf = xstrdup("");
 
        if (args_has(args, 'p')) {
                c = cmdq->client;
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 2770bd4..e2f78e1 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -30,14 +30,14 @@
 enum cmd_retval         cmd_show_options_exec(struct cmd *, struct cmd_q *);
 
 enum cmd_retval        cmd_show_options_one(struct cmd *, struct cmd_q *,
-                   struct options *);
+                   struct options *, int);
 enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *,
                    const struct options_table_entry *, struct options *);
 
 const struct cmd_entry cmd_show_options_entry = {
        "show-options", "show",
-       "gst:vw", 0, 1,
-       "[-gsvw] [-t target-session|target-window] [option]",
+       "gqst:vw", 0, 1,
+       "[-gqsvw] [-t target-session|target-window] [option]",
        0,
        NULL,
        NULL,
@@ -62,6 +62,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
        struct winlink                          *wl;
        const struct options_table_entry        *table;
        struct options                          *oo;
+       int                                      quiet;
 
        if (args_has(self->args, 's')) {
                oo = &global_options;
@@ -89,15 +90,16 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
                }
        }
 
-       if (args->argc != 0)
-               return (cmd_show_options_one(self, cmdq, oo));
-       else
+       quiet = args_has(self->args, 'q');
+       if (args->argc == 0)
                return (cmd_show_options_all(self, cmdq, table, oo));
+       else
+               return (cmd_show_options_one(self, cmdq, oo, quiet));
 }
 
 enum cmd_retval
 cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
-    struct options *oo)
+    struct options *oo, int quiet)
 {
        struct args                             *args = self->args;
        const struct options_table_entry        *table, *oe;
@@ -106,6 +108,8 @@ cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
 
        if (*args->argv[0] == '@') {
                if ((o = options_find1(oo, args->argv[0])) == NULL) {
+                       if (quiet)
+                               return (CMD_RETURN_NORMAL);
                        cmdq_error(cmdq, "unknown option: %s", args->argv[0]);
                        return (CMD_RETURN_ERROR);
                }
@@ -122,6 +126,8 @@ cmd_show_options_one(struct cmd *self, struct cmd_q *cmdq,
                return (CMD_RETURN_ERROR);
        }
        if (oe == NULL) {
+               if (quiet)
+                   return (CMD_RETURN_NORMAL);
                cmdq_error(cmdq, "unknown option: %s", args->argv[0]);
                return (CMD_RETURN_ERROR);
        }
diff --git a/tmux.1 b/tmux.1
index 6087700..a094d58 100644
--- a/tmux.1
+++ b/tmux.1
@@ -1066,7 +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 aep
+.Op Fl aepq
 .Op Fl b Ar buffer-index
 .Op Fl E Ar end-line
 .Op Fl S Ar start-line
@@ -1082,6 +1082,9 @@ or a new buffer if omitted.
 If
 .Fl a
 is given, the alternate screen is used, and the history is not accessible.
+If no alternate screen exists, an error will be returned unless
+.Fl q
+is given.
 If
 .Fl e
 is given, the output includes escape sequences for text and background
@@ -2952,7 +2955,7 @@ If this option is set, searches will wrap around the end 
of the pane contents.
 The default is on.
 .El
 .It Xo Ic show-options
-.Op Fl gsvw
+.Op Fl gqsvw
 .Op Fl t Ar target-session | Ar target-window
 .Op Ar option
 .Xc
@@ -2970,6 +2973,11 @@ Global session or window options are listed if
 is used.
 .Fl v
 shows only the option value, not the name.
+If
+.Fl q
+is set, no error will be returned if
+.Ar option
+is unset.
 .It Xo Ic show-window-options
 .Op Fl gv
 .Op Fl t Ar target-window


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

Summary of changes:
 cmd-capture-pane.c |   95 +++++++++++++++++++++++++++-------------------------
 cmd-show-options.c |   20 +++++++----
 control-notify.c   |   13 +------
 tmux.1             |   12 +++++-
 4 files changed, 74 insertions(+), 66 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to