summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/format.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-02-22 11:10:42 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-02-22 11:10:42 +0000
commit55b8f279c72f36088270ab4988aaae4de9d1f6cc (patch)
treeb542f767955337711a6354c27a64f4adfe3638e1 /usr.bin/tmux/format.c
parent36e5c39a280f6af578d8db385438e7d0990c3204 (diff)
Add next_session_id format with the next session ID, GitHub issue 3078.
Diffstat (limited to 'usr.bin/tmux/format.c')
-rw-r--r--usr.bin/tmux/format.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index ea6cd40844c..2b2a0b70b26 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.299 2021/10/25 21:21:16 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.300 2022/02/22 11:10:41 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1650,6 +1650,13 @@ format_cb_mouse_y(struct format_tree *ft)
return (NULL);
}
+/* Callback for next_session_id. */
+static void *
+format_cb_next_session_id(__unused struct format_tree *ft)
+{
+ return (format_printf("$%u", next_session_id));
+}
+
/* Callback for origin_flag. */
static void *
format_cb_origin_flag(struct format_tree *ft)
@@ -2707,6 +2714,9 @@ static const struct format_table_entry format_table[] = {
{ "mouse_y", FORMAT_TABLE_STRING,
format_cb_mouse_y
},
+ { "next_session_id", FORMAT_TABLE_STRING,
+ format_cb_next_session_id
+ },
{ "origin_flag", FORMAT_TABLE_STRING,
format_cb_origin_flag
},