-/* $OpenBSD: cmd-list-windows.c,v 1.46 2020/04/13 10:59:58 nicm Exp $ */
+/* $OpenBSD: cmd-list-windows.c,v 1.47 2021/01/20 07:16:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
*/
#define LIST_WINDOWS_TEMPLATE \
- "#{window_index}: #{window_name}#{window_flags} " \
+ "#{window_index}: #{window_name}#{window_raw_flags} " \
"(#{window_panes} panes) " \
"[#{window_width}x#{window_height}] " \
"[layout #{window_layout}] #{window_id}" \
"#{?window_active, (active),}";
#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \
"#{session_name}:" \
- "#{window_index}: #{window_name}#{window_flags} " \
+ "#{window_index}: #{window_name}#{window_raw_flags} " \
"(#{window_panes} panes) " \
"[#{window_width}x#{window_height}] "
-/* $OpenBSD: control-notify.c,v 1.27 2020/05/21 07:24:13 nicm Exp $ */
+/* $OpenBSD: control-notify.c,v 1.28 2021/01/20 07:16:54 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
char *cp;
template = "%layout-change #{window_id} #{window_layout} "
- "#{window_visible_layout} #{window_flags}";
+ "#{window_visible_layout} #{window_raw_flags}";
TAILQ_FOREACH(c, &clients, entry) {
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
-/* $OpenBSD: format.c,v 1.269 2020/12/30 18:29:40 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.270 2021/01/20 07:16:54 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
#define FORMAT_TIMESTRING 0x1
#define FORMAT_BASENAME 0x2
#define FORMAT_DIRNAME 0x4
-#define FORMAT_QUOTE 0x8
+#define FORMAT_QUOTE_SHELL 0x8
#define FORMAT_LITERAL 0x10
#define FORMAT_EXPAND 0x20
#define FORMAT_EXPANDTIME 0x40
#define FORMAT_PRETTY 0x400
#define FORMAT_LENGTH 0x800
#define FORMAT_WIDTH 0x1000
-#define FORMAT_ESCAPE 0x2000
+#define FORMAT_QUOTE_STYLE 0x2000
/* Limit on recursion. */
#define FORMAT_LOOP_LIMIT 10
fe->value = NULL;
}
-/* Quote special characters in string. */
+/* Quote shell special characters in string. */
static char *
-format_quote(const char *s)
+format_quote_shell(const char *s)
{
const char *cp;
char *out, *at;
return (out);
}
-/* Escape #s in string. */
+/* Quote #s in string. */
static char *
-format_escape(const char *s)
+format_quote_style(const char *s)
{
const char *cp;
char *out, *at;
found = xstrdup(dirname(saved));
free(saved);
}
- if (modifiers & FORMAT_QUOTE) {
+ if (modifiers & FORMAT_QUOTE_SHELL) {
saved = found;
- found = xstrdup(format_quote(saved));
+ found = xstrdup(format_quote_shell(saved));
free(saved);
}
- if (modifiers & FORMAT_ESCAPE) {
+ if (modifiers & FORMAT_QUOTE_STYLE) {
saved = found;
- found = xstrdup(format_escape(saved));
+ found = xstrdup(format_quote_style(saved));
free(saved);
}
return (found);
break;
case 'q':
if (fm->argc < 1)
- modifiers |= FORMAT_QUOTE;
- else if (strchr(fm->argv[0], 'e') != NULL)
- modifiers |= FORMAT_ESCAPE;
+ modifiers |= FORMAT_QUOTE_SHELL;
+ else if (strchr(fm->argv[0], 'e') != NULL ||
+ strchr(fm->argv[0], 'h') != NULL)
+ modifiers |= FORMAT_QUOTE_STYLE;
break;
case 'E':
modifiers |= FORMAT_EXPAND;
format_add(ft, "window_index", "%d", wl->idx);
format_add_cb(ft, "window_stack_index", format_cb_window_stack_index);
- format_add(ft, "window_flags", "%s", window_printable_flags(wl));
+ format_add(ft, "window_flags", "%s", window_printable_flags(wl, 1));
+ format_add(ft, "window_raw_flags", "%s", window_printable_flags(wl, 0));
format_add(ft, "window_active", "%d", wl == s->curw);
format_add_cb(ft, "window_active_sessions",
format_cb_window_active_sessions);
-/* $OpenBSD: options-table.c,v 1.137 2021/01/04 08:43:16 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.138 2021/01/20 07:16:54 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
{ .name = "window-status-current-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
- .default_str = "#I:#W#{?window_flags,#{q/e:window_flags}, }",
+ .default_str = "#I:#W#{?window_flags,#{window_flags}, }",
.text = "Format of the current window in the status line."
},
{ .name = "window-status-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
- .default_str = "#I:#W#{?window_flags,#{q/e:window_flags}, }",
+ .default_str = "#I:#W#{?window_flags,#{window_flags}, }",
.text = "Format of windows in the status line, except the current "
"window."
},
-.\" $OpenBSD: tmux.1,v 1.811 2021/01/17 16:17:41 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.812 2021/01/20 07:16:54 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 17 2021 $
+.Dd $Mdocdate: January 20 2021 $
.Dt TMUX 1
.Os
.Sh NAME
.Ql q:\&
will escape
.Xr sh 1
-special characters or with an
-.Ql e
+special characters or with a
+.Ql h
suffix, escape hash characters (so
.Ql #
becomes
.It Li "window_cell_height" Ta "" Ta "Height of each cell in pixels"
.It Li "window_cell_width" Ta "" Ta "Width of each cell in pixels"
.It Li "window_end_flag" Ta "" Ta "1 if window has the highest index"
-.It Li "window_flags" Ta "#F" Ta "Window flags"
+.It Li "window_flags" Ta "#F" Ta "Window flags with # escaped as ##"
+.It Li "window_raw_flags" Ta "" Ta "Window flags with nothing escaped"
.It Li "window_format" Ta "" Ta "1 if format is for a window"
.It Li "window_height" Ta "" Ta "Height of window"
.It Li "window_id" Ta "" Ta "Unique window ID"
-/* $OpenBSD: tmux.h,v 1.1085 2021/01/18 10:27:54 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1086 2021/01/20 07:16:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
int window_pane_visible(struct window_pane *);
u_int window_pane_search(struct window_pane *, const char *, int,
int);
-const char *window_printable_flags(struct winlink *);
+const char *window_printable_flags(struct winlink *, int);
struct window_pane *window_pane_find_up(struct window_pane *);
struct window_pane *window_pane_find_down(struct window_pane *);
struct window_pane *window_pane_find_left(struct window_pane *);
-/* $OpenBSD: window.c,v 1.267 2020/12/15 08:31:50 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.268 2021/01/20 07:16:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
}
const char *
-window_printable_flags(struct winlink *wl)
+window_printable_flags(struct winlink *wl, int escape)
{
struct session *s = wl->session;
static char flags[32];
int pos;
pos = 0;
- if (wl->flags & WINLINK_ACTIVITY)
+ if (wl->flags & WINLINK_ACTIVITY) {
flags[pos++] = '#';
+ if (escape)
+ flags[pos++] = '#';
+ }
if (wl->flags & WINLINK_BELL)
flags[pos++] = '!';
if (wl->flags & WINLINK_SILENCE)