mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:33:27 +00:00
Add a helper function for the most common format_create/defaults/expand
pattern.
This commit is contained in:
@ -64,10 +64,9 @@ control_notify_window_layout_changed(struct window *w)
|
||||
{
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct format_tree *ft;
|
||||
struct winlink *wl;
|
||||
const char *template;
|
||||
char *expanded;
|
||||
char *cp;
|
||||
|
||||
template = "%layout-change #{window_id} #{window_layout} "
|
||||
"#{window_visible_layout} #{window_flags}";
|
||||
@ -88,15 +87,12 @@ control_notify_window_layout_changed(struct window *w)
|
||||
if (w->layout_root == NULL)
|
||||
continue;
|
||||
|
||||
ft = format_create(NULL, FORMAT_NONE, 0);
|
||||
wl = winlink_find_by_window(&s->windows, w);
|
||||
if (wl != NULL) {
|
||||
format_defaults(ft, c, NULL, wl, NULL);
|
||||
expanded = format_expand(ft, template);
|
||||
control_write(c, "%s", expanded);
|
||||
free(expanded);
|
||||
cp = format_single(NULL, template, c, NULL, wl, NULL);
|
||||
control_write(c, "%s", cp);
|
||||
free(cp);
|
||||
}
|
||||
format_free(ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user