mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 03:56:28 +00:00
Bring some new formats from the floating panes work: pane_zoomed_flag,
pane_flags, pane_floating_flag. By Michael Grant.
This commit is contained in:
@@ -90,7 +90,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
|
||||
previous = 1;
|
||||
|
||||
oldlayout = w->old_layout;
|
||||
w->old_layout = layout_dump(w->layout_root);
|
||||
w->old_layout = layout_dump(w, w->layout_root);
|
||||
|
||||
if (next || previous) {
|
||||
if (next)
|
||||
|
||||
52
format.c
52
format.c
@@ -811,8 +811,8 @@ format_cb_window_layout(struct format_tree *ft)
|
||||
return (NULL);
|
||||
|
||||
if (w->saved_layout_root != NULL)
|
||||
return (layout_dump(w->saved_layout_root));
|
||||
return (layout_dump(w->layout_root));
|
||||
return (layout_dump(w, w->saved_layout_root));
|
||||
return (layout_dump(w, w->layout_root));
|
||||
}
|
||||
|
||||
/* Callback for window_visible_layout. */
|
||||
@@ -824,7 +824,7 @@ format_cb_window_visible_layout(struct format_tree *ft)
|
||||
if (w == NULL)
|
||||
return (NULL);
|
||||
|
||||
return (layout_dump(w->layout_root));
|
||||
return (layout_dump(w, w->layout_root));
|
||||
}
|
||||
|
||||
/* Callback for pane_start_command. */
|
||||
@@ -990,6 +990,29 @@ format_cb_pane_fg(struct format_tree *ft)
|
||||
return (xstrdup(colour_tostring(gc.fg)));
|
||||
}
|
||||
|
||||
/* Callback for pane_flags. */
|
||||
static void *
|
||||
format_cb_pane_flags(struct format_tree *ft)
|
||||
{
|
||||
if (ft->wp != NULL)
|
||||
return (xstrdup(window_pane_printable_flags(ft->wp)));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for pane_floating_flag. */
|
||||
static void *
|
||||
format_cb_pane_floating_flag(struct format_tree *ft)
|
||||
{
|
||||
struct window_pane *wp = ft->wp;
|
||||
|
||||
if (wp != NULL) {
|
||||
if (wp->flags & PANE_FLOATING)
|
||||
return (xstrdup("1"));
|
||||
return (xstrdup("0"));
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for pane_bg. */
|
||||
static void *
|
||||
format_cb_pane_bg(struct format_tree *ft)
|
||||
@@ -2351,6 +2374,20 @@ format_cb_pane_width(struct format_tree *ft)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for pane_zoomed_flag. */
|
||||
static void *
|
||||
format_cb_pane_zoomed_flag(struct format_tree *ft)
|
||||
{
|
||||
struct window_pane *wp = ft->wp;
|
||||
|
||||
if (wp != NULL) {
|
||||
if (wp->flags & PANE_ZOOMED)
|
||||
return (xstrdup("1"));
|
||||
return (xstrdup("0"));
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for scroll_region_lower. */
|
||||
static void *
|
||||
format_cb_scroll_region_lower(struct format_tree *ft)
|
||||
@@ -3326,6 +3363,12 @@ static const struct format_table_entry format_table[] = {
|
||||
{ "pane_fg", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_fg
|
||||
},
|
||||
{ "pane_flags", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_flags
|
||||
},
|
||||
{ "pane_floating_flag", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_floating_flag
|
||||
},
|
||||
{ "pane_format", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_format
|
||||
},
|
||||
@@ -3413,6 +3456,9 @@ static const struct format_table_entry format_table[] = {
|
||||
{ "pane_width", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_width
|
||||
},
|
||||
{ "pane_zoomed_flag", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_zoomed_flag
|
||||
},
|
||||
{ "pid", FORMAT_TABLE_STRING,
|
||||
format_cb_pid
|
||||
},
|
||||
|
||||
@@ -58,7 +58,7 @@ layout_checksum(const char *layout)
|
||||
|
||||
/* Dump layout as a string. */
|
||||
char *
|
||||
layout_dump(struct layout_cell *root)
|
||||
layout_dump(__unused struct window *w, struct layout_cell *root)
|
||||
{
|
||||
char layout[8192], *out;
|
||||
|
||||
|
||||
3
tmux.1
3
tmux.1
@@ -6369,6 +6369,8 @@ The following variables are available, where appropriate:
|
||||
.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
|
||||
.It Li "pane_dead_time" Ta "" Ta "Exit time of process in dead pane"
|
||||
.It Li "pane_fg" Ta "" Ta "Pane foreground colour"
|
||||
.It Li "pane_flags" Ta "" Ta "Pane flags"
|
||||
.It Li "pane_floating_flag" Ta "" Ta "1 if pane is floating"
|
||||
.It Li "pane_format" Ta "" Ta "1 if format is for a pane"
|
||||
.It Li "pane_height" Ta "" Ta "Height of pane"
|
||||
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
|
||||
@@ -6398,6 +6400,7 @@ The following variables are available, where appropriate:
|
||||
.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
|
||||
.It Li "pane_unseen_changes" Ta "" Ta "1 if there were changes in pane while in mode"
|
||||
.It Li "pane_width" Ta "" Ta "Width of pane"
|
||||
.It Li "pane_floating_flag" Ta "" Ta "1 if pane is floating"
|
||||
.It Li "pid" Ta "" Ta "Server PID"
|
||||
.It Li "prev_window_active" Ta "" Ta "1 if previous window in W: loop is active"
|
||||
.It Li "prev_window_index" Ta "" Ta "Index of previous window in W: loop"
|
||||
|
||||
5
tmux.h
5
tmux.h
@@ -1218,7 +1218,7 @@ struct window_pane {
|
||||
#define PANE_FOCUSED 0x4
|
||||
#define PANE_VISITED 0x8
|
||||
#define PANE_ZOOMED 0x10
|
||||
/* 0x20 unused */
|
||||
#define PANE_FLOATING 0x20
|
||||
#define PANE_INPUTOFF 0x40
|
||||
#define PANE_CHANGED 0x80
|
||||
#define PANE_EXITED 0x100
|
||||
@@ -3372,6 +3372,7 @@ int window_pane_exited(struct window_pane *);
|
||||
u_int window_pane_search(struct window_pane *, const char *, int,
|
||||
int);
|
||||
const char *window_printable_flags(struct winlink *, int);
|
||||
const char *window_pane_printable_flags(struct window_pane *);
|
||||
struct window_pane *window_pane_find_up(struct window_pane *);
|
||||
struct window_pane *window_pane_find_down(struct window_pane *);
|
||||
struct window_pane *window_pane_find_left(struct window_pane *);
|
||||
@@ -3439,7 +3440,7 @@ int layout_spread_cell(struct window *, struct layout_cell *);
|
||||
void layout_spread_out(struct window_pane *);
|
||||
|
||||
/* layout-custom.c */
|
||||
char *layout_dump(struct layout_cell *);
|
||||
char *layout_dump(struct window *, struct layout_cell *);
|
||||
int layout_parse(struct window *, const char *, char **);
|
||||
|
||||
/* layout-set.c */
|
||||
|
||||
22
window.c
22
window.c
@@ -882,9 +882,8 @@ window_printable_flags(struct winlink *wl, int escape)
|
||||
{
|
||||
struct session *s = wl->session;
|
||||
static char flags[32];
|
||||
int pos;
|
||||
u_int pos = 0;
|
||||
|
||||
pos = 0;
|
||||
if (wl->flags & WINLINK_ACTIVITY) {
|
||||
flags[pos++] = '#';
|
||||
if (escape)
|
||||
@@ -906,6 +905,25 @@ window_printable_flags(struct winlink *wl, int escape)
|
||||
return (flags);
|
||||
}
|
||||
|
||||
const char *
|
||||
window_pane_printable_flags(struct window_pane *wp)
|
||||
{
|
||||
struct window *w = wp->window;
|
||||
static char flags[32];
|
||||
u_int pos = 0;
|
||||
|
||||
if (wp == w->active)
|
||||
flags[pos++] = '*';
|
||||
if (wp == TAILQ_FIRST(&w->last_panes))
|
||||
flags[pos++] = '-';
|
||||
if (wp->flags & PANE_ZOOMED)
|
||||
flags[pos++] = 'Z';
|
||||
if (wp->flags & PANE_FLOATING)
|
||||
flags[pos++] = 'F';
|
||||
flags[pos] = '\0';
|
||||
return (flags);
|
||||
}
|
||||
|
||||
struct window_pane *
|
||||
window_pane_find_by_id_str(const char *s)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user