=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/format.c,v retrieving revision 1.163 retrieving revision 1.164 diff -c -r1.163 -r1.164 *** src/usr.bin/tmux/format.c 2018/09/27 07:43:18 1.163 --- src/usr.bin/tmux/format.c 2018/10/18 08:38:01 1.164 *************** *** 1,4 **** ! /* $OpenBSD: format.c,v 1.163 2018/09/27 07:43:18 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: format.c,v 1.164 2018/10/18 08:38:01 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott *************** *** 52,59 **** static void format_defaults_session(struct format_tree *, struct session *); static void format_defaults_client(struct format_tree *, struct client *); ! static void format_defaults_winlink(struct format_tree *, ! struct winlink *); /* Entry in format job tree. */ struct format_job { --- 52,58 ---- static void format_defaults_session(struct format_tree *, struct session *); static void format_defaults_client(struct format_tree *, struct client *); ! static void format_defaults_winlink(struct format_tree *, struct winlink *); /* Entry in format job tree. */ struct format_job { *************** *** 107,115 **** /* Format entry tree. */ struct format_tree { ! struct window *w; ! struct winlink *wl; struct session *s; struct window_pane *wp; struct client *client; --- 106,115 ---- /* Format entry tree. */ struct format_tree { ! struct client *c; struct session *s; + struct winlink *wl; + struct window *w; struct window_pane *wp; struct client *client; *************** *** 1347,1354 **** format_add(ft, "session_name", "%s", s->name); format_add(ft, "session_windows", "%u", winlink_count(&s->windows)); - format_add(ft, "session_width", "%u", s->sx); - format_add(ft, "session_height", "%u", s->sy); format_add(ft, "session_id", "$%u", s->id); sg = session_group_contains(s); --- 1347,1352 ---- *************** *** 1383,1388 **** --- 1381,1387 ---- if (ft->s == NULL) ft->s = c->session; + ft->c = c; format_add(ft, "client_name", "%s", c->name); format_add(ft, "client_pid", "%ld", (long) c->pid); *************** *** 1451,1458 **** --- 1450,1460 ---- static void format_defaults_winlink(struct format_tree *ft, struct winlink *wl) { + struct client *c = ft->c; struct session *s = wl->session; struct window *w = wl->window; + int flag; + u_int ox, oy, sx, sy; if (ft->w == NULL) ft->w = wl->window; *************** *** 1460,1465 **** --- 1462,1476 ---- format_defaults_window(ft, w); + if (c != NULL) { + flag = tty_window_offset(&c->tty, &ox, &oy, &sx, &sy); + format_add(ft, "window_bigger", "%d", flag); + if (flag) { + format_add(ft, "window_offset_x", "%u", ox); + format_add(ft, "window_offset_y", "%u", oy); + } + } + 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)); *************** *** 1509,1526 **** format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status)); format_add(ft, "pane_dead", "%d", wp->fd == -1); ! if (window_pane_visible(wp)) { ! format_add(ft, "pane_left", "%u", wp->xoff); ! format_add(ft, "pane_top", "%u", wp->yoff); ! format_add(ft, "pane_right", "%u", wp->xoff + wp->sx - 1); ! format_add(ft, "pane_bottom", "%u", wp->yoff + wp->sy - 1); ! format_add(ft, "pane_at_left", "%d", wp->xoff == 0); ! format_add(ft, "pane_at_top", "%d", wp->yoff == 0); ! format_add(ft, "pane_at_right", "%d", ! wp->xoff + wp->sx == w->sx); ! format_add(ft, "pane_at_bottom", "%d", ! wp->yoff + wp->sy == w->sy); ! } format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base); if (wp->mode != NULL) --- 1520,1533 ---- format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status)); format_add(ft, "pane_dead", "%d", wp->fd == -1); ! format_add(ft, "pane_left", "%u", wp->xoff); ! format_add(ft, "pane_top", "%u", wp->yoff); ! format_add(ft, "pane_right", "%u", wp->xoff + wp->sx - 1); ! format_add(ft, "pane_bottom", "%u", wp->yoff + wp->sy - 1); ! format_add(ft, "pane_at_left", "%d", wp->xoff == 0); ! format_add(ft, "pane_at_top", "%d", wp->yoff == 0); ! format_add(ft, "pane_at_right", "%d", wp->xoff + wp->sx == w->sx); ! format_add(ft, "pane_at_bottom", "%d", wp->yoff + wp->sy == w->sy); format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base); if (wp->mode != NULL)