From a9b880921dce2836611873a4ec85e9425dc08b40 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 22 Feb 2022 11:01:57 +0000 Subject: Use correct size for screen when popup is created without borders. --- popup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/popup.c b/popup.c index a3b33dce..12f31c40 100644 --- a/popup.c +++ b/popup.c @@ -690,7 +690,7 @@ popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px, } pd->border_cell.attr = 0; - screen_init(&pd->s, sx - 2, sy - 2, 0); + screen_init(&pd->s, jx, jy, 0); colour_palette_init(&pd->palette); colour_palette_from_option(&pd->palette, global_w_options); -- cgit v1.2.3 From 0fd01f8873ccae655b0f997ca0dc46c42ebe399d Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 22 Feb 2022 11:07:25 +0000 Subject: Initialize copy_width before adjusting it, GitHub issue 3079. --- format-draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/format-draw.c b/format-draw.c index 1110535f..1a7e60b3 100644 --- a/format-draw.c +++ b/format-draw.c @@ -1154,13 +1154,13 @@ format_trim_right(const char *expanded, u_int limit) while (*cp != '\0') { if (*cp == '#') { end = format_leading_hashes(cp, &n, &leading_width); + copy_width = leading_width; if (width <= skip) { - if (skip - width >= leading_width) + if (skip - width >= copy_width) copy_width = 0; else copy_width -= (skip - width); - } else - copy_width = leading_width; + } if (copy_width != 0) { if (n == 1) *out++ = '#'; -- cgit v1.2.3 From fa71e9a07911715da596d618fe045943337c596b Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 22 Feb 2022 11:10:41 +0000 Subject: Add next_session_id format with the next session ID, GitHub issue 3078. --- format.c | 10 ++++++++++ session.c | 2 +- tmux.1 | 6 ++++++ tmux.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/format.c b/format.c index b34fc341..15f3179c 100644 --- a/format.c +++ b/format.c @@ -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 }, diff --git a/session.c b/session.c index fd567926..9b9b0d9c 100644 --- a/session.c +++ b/session.c @@ -29,7 +29,7 @@ #include "tmux.h" struct sessions sessions; -static u_int next_session_id; +u_int next_session_id; struct session_groups session_groups = RB_INITIALIZER(&session_groups); static void session_free(int, short, void *); diff --git a/tmux.1 b/tmux.1 index c9c9f221..22eb6b1f 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4589,6 +4589,11 @@ Run when a session is renamed. Run when a window is linked into a session. .It window-renamed Run when a window is renamed. +.It window-resized +Run when a window is resized. +This may be after the +.Ar client-resized +hook is run. .It window-unlinked Run when a window is unlinked from a session. .El @@ -5093,6 +5098,7 @@ The following variables are available, where appropriate: .It Li "mouse_word" Ta "" Ta "Word under mouse, if any" .It Li "mouse_x" Ta "" Ta "Mouse X position, if any" .It Li "mouse_y" Ta "" Ta "Mouse Y position, if any" +.It Li "next_session_id" Ta "" Ta "Unique session ID for next new session" .It Li "origin_flag" Ta "" Ta "Pane origin flag" .It Li "pane_active" Ta "" Ta "1 if active pane" .It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window" diff --git a/tmux.h b/tmux.h index fa5b6b50..7a83732e 100644 --- a/tmux.h +++ b/tmux.h @@ -3118,6 +3118,7 @@ void control_notify_session_window_changed(struct session *); /* session.c */ extern struct sessions sessions; +extern u_int next_session_id; int session_cmp(struct session *, struct session *); RB_PROTOTYPE(sessions, session, entry, session_cmp); int session_alive(struct session *); -- cgit v1.2.3