From 8bd29a30bff4e9d50765e2168a7aad11e163ccde Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 15 Dec 2020 08:31:50 +0000 Subject: Make synchronize-panes a pane option and add -U flag to set-option to unset an option on all panes. GitHub issue 2491 from Rostislav Nesin. --- window.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 66298495..22986a04 100644 --- a/window.c +++ b/window.c @@ -1145,12 +1145,27 @@ window_pane_reset_mode_all(struct window_pane *wp) window_pane_reset_mode(wp); } +static void +window_pane_copy_key(struct window_pane *wp, key_code key) +{ + struct window_pane *loop; + + TAILQ_FOREACH(loop, &wp->window->panes, entry) { + if (loop != wp && + TAILQ_EMPTY(&loop->modes) && + loop->fd != -1 && + (~loop->flags & PANE_INPUTOFF) && + window_pane_visible(loop) && + options_get_number(loop->options, "synchronize-panes")) + input_key_pane(loop, key, NULL); + } +} + int window_pane_key(struct window_pane *wp, struct client *c, struct session *s, struct winlink *wl, key_code key, struct mouse_event *m) { struct window_mode_entry *wme; - struct window_pane *wp2; if (KEYC_IS_MOUSE(key) && m == NULL) return (-1); @@ -1172,16 +1187,8 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s, if (KEYC_IS_MOUSE(key)) return (0); - if (options_get_number(wp->window->options, "synchronize-panes")) { - TAILQ_FOREACH(wp2, &wp->window->panes, entry) { - if (wp2 != wp && - TAILQ_EMPTY(&wp2->modes) && - wp2->fd != -1 && - (~wp2->flags & PANE_INPUTOFF) && - window_pane_visible(wp2)) - input_key_pane(wp2, key, NULL); - } - } + if (options_get_number(wp->options, "synchronize-panes")) + window_pane_copy_key(wp, key); return (0); } -- cgit From fb774b77d0f5ccb988b508b8a794633d4c9a5962 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 20 Jan 2021 07:16:54 +0000 Subject: Change so that window_flags escapes # automatically which means configs will not have to change. A new format window_raw_flags contains the old unescaped version. --- window.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 22986a04..6bfdb1cd 100644 --- a/window.c +++ b/window.c @@ -803,15 +803,18 @@ window_destroy_panes(struct window *w) } 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) -- cgit From e858270006a9041b9016ed9e6cc12d622ac8fe31 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 22 Feb 2021 07:09:06 +0000 Subject: There are many format variables now so allocating all the default ones each time a tree is created is too expensive. Instead, convert them all into callbacks and put them in a static table so they only allocate on demand. The tree remains for the moment for extra (non-default) variables added by for example copy mode or popups. Also reduce expensive calls to localtime_r/strftime. GitHub issue 2253. --- window.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 6bfdb1cd..07ef513f 100644 --- a/window.c +++ b/window.c @@ -63,17 +63,6 @@ static u_int next_window_pane_id; static u_int next_window_id; static u_int next_active_point; -/* List of window modes. */ -const struct window_mode *all_window_modes[] = { - &window_buffer_mode, - &window_client_mode, - &window_clock_mode, - &window_copy_mode, - &window_tree_mode, - &window_view_mode, - NULL -}; - struct window_pane_input_data { struct cmdq_item *item; u_int wp; -- cgit