mirror of
https://github.com/tmux/tmux.git
synced 2026-04-16 03:56:28 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@@ -90,7 +90,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
previous = 1;
|
previous = 1;
|
||||||
|
|
||||||
oldlayout = w->old_layout;
|
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 || previous) {
|
||||||
if (next)
|
if (next)
|
||||||
|
|||||||
67
format.c
67
format.c
@@ -825,8 +825,8 @@ format_cb_window_layout(struct format_tree *ft)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (w->saved_layout_root != NULL)
|
if (w->saved_layout_root != NULL)
|
||||||
return (layout_dump(w->saved_layout_root));
|
return (layout_dump(w, w->saved_layout_root));
|
||||||
return (layout_dump(w->layout_root));
|
return (layout_dump(w, w->layout_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for window_visible_layout. */
|
/* Callback for window_visible_layout. */
|
||||||
@@ -838,7 +838,7 @@ format_cb_window_visible_layout(struct format_tree *ft)
|
|||||||
if (w == NULL)
|
if (w == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
return (layout_dump(w->layout_root));
|
return (layout_dump(w, w->layout_root));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for pane_start_command. */
|
/* Callback for pane_start_command. */
|
||||||
@@ -1004,6 +1004,29 @@ format_cb_pane_fg(struct format_tree *ft)
|
|||||||
return (xstrdup(colour_tostring(gc.fg)));
|
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. */
|
/* Callback for pane_bg. */
|
||||||
static void *
|
static void *
|
||||||
format_cb_pane_bg(struct format_tree *ft)
|
format_cb_pane_bg(struct format_tree *ft)
|
||||||
@@ -1607,9 +1630,13 @@ format_cb_client_user(struct format_tree *ft)
|
|||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
if (ft->c != NULL) {
|
if (ft->c != NULL) {
|
||||||
|
if (ft->c->user != NULL)
|
||||||
|
return (xstrdup(ft->c->user));
|
||||||
uid = proc_get_peer_uid(ft->c->peer);
|
uid = proc_get_peer_uid(ft->c->peer);
|
||||||
if (uid != (uid_t)-1 && (pw = getpwuid(uid)) != NULL)
|
if (uid != (uid_t)-1 && (pw = getpwuid(uid)) != NULL) {
|
||||||
return (xstrdup(pw->pw_name));
|
ft->c->user = xstrdup(pw->pw_name);
|
||||||
|
return (xstrdup(ft->c->user));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -2365,6 +2392,20 @@ format_cb_pane_width(struct format_tree *ft)
|
|||||||
return (NULL);
|
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. */
|
/* Callback for scroll_region_lower. */
|
||||||
static void *
|
static void *
|
||||||
format_cb_scroll_region_lower(struct format_tree *ft)
|
format_cb_scroll_region_lower(struct format_tree *ft)
|
||||||
@@ -3057,10 +3098,13 @@ format_cb_uid(__unused struct format_tree *ft)
|
|||||||
static void *
|
static void *
|
||||||
format_cb_user(__unused struct format_tree *ft)
|
format_cb_user(__unused struct format_tree *ft)
|
||||||
{
|
{
|
||||||
|
static char *cached;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
if ((pw = getpwuid(getuid())) != NULL)
|
if (cached == NULL && (pw = getpwuid(getuid())) != NULL)
|
||||||
return (xstrdup(pw->pw_name));
|
cached = xstrdup(pw->pw_name);
|
||||||
|
if (cached != NULL)
|
||||||
|
return (xstrdup(cached));
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3344,6 +3388,12 @@ static const struct format_table_entry format_table[] = {
|
|||||||
{ "pane_fg", FORMAT_TABLE_STRING,
|
{ "pane_fg", FORMAT_TABLE_STRING,
|
||||||
format_cb_pane_fg
|
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,
|
{ "pane_format", FORMAT_TABLE_STRING,
|
||||||
format_cb_pane_format
|
format_cb_pane_format
|
||||||
},
|
},
|
||||||
@@ -3431,6 +3481,9 @@ static const struct format_table_entry format_table[] = {
|
|||||||
{ "pane_width", FORMAT_TABLE_STRING,
|
{ "pane_width", FORMAT_TABLE_STRING,
|
||||||
format_cb_pane_width
|
format_cb_pane_width
|
||||||
},
|
},
|
||||||
|
{ "pane_zoomed_flag", FORMAT_TABLE_STRING,
|
||||||
|
format_cb_pane_zoomed_flag
|
||||||
|
},
|
||||||
{ "pid", FORMAT_TABLE_STRING,
|
{ "pid", FORMAT_TABLE_STRING,
|
||||||
format_cb_pid
|
format_cb_pid
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ layout_checksum(const char *layout)
|
|||||||
|
|
||||||
/* Dump layout as a string. */
|
/* Dump layout as a string. */
|
||||||
char *
|
char *
|
||||||
layout_dump(struct layout_cell *root)
|
layout_dump(__unused struct window *w, struct layout_cell *root)
|
||||||
{
|
{
|
||||||
char layout[8192], *out;
|
char layout[8192], *out;
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static const char *options_table_window_size_list[] = {
|
|||||||
"largest", "smallest", "manual", "latest", NULL
|
"largest", "smallest", "manual", "latest", NULL
|
||||||
};
|
};
|
||||||
static const char *options_table_remain_on_exit_list[] = {
|
static const char *options_table_remain_on_exit_list[] = {
|
||||||
"off", "on", "failed", NULL
|
"off", "on", "failed", "key", NULL
|
||||||
};
|
};
|
||||||
static const char *options_table_destroy_unattached_list[] = {
|
static const char *options_table_destroy_unattached_list[] = {
|
||||||
"off", "on", "keep-last", "keep-group", NULL
|
"off", "on", "keep-last", "keep-group", NULL
|
||||||
@@ -1407,8 +1407,9 @@ const struct options_table_entry options_table[] = {
|
|||||||
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
|
||||||
.choices = options_table_remain_on_exit_list,
|
.choices = options_table_remain_on_exit_list,
|
||||||
.default_num = 0,
|
.default_num = 0,
|
||||||
.text = "Whether panes should remain ('on') or be automatically "
|
.text = "Whether panes should remain ('on'), remain until a key is "
|
||||||
"killed ('off' or 'failed') when the program inside exits."
|
"pressed ('key') or be automatically killed ('off' or "
|
||||||
|
"'failed') when the program inside exits."
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "remain-on-exit-format",
|
{ .name = "remain-on-exit-format",
|
||||||
|
|||||||
@@ -533,6 +533,7 @@ server_client_free(__unused int fd, __unused short events, void *arg)
|
|||||||
|
|
||||||
if (c->references == 0) {
|
if (c->references == 0) {
|
||||||
free((void *)c->name);
|
free((void *)c->name);
|
||||||
|
free((void *)c->user);
|
||||||
free(c);
|
free(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1355,6 +1356,15 @@ try_again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
forward_key:
|
forward_key:
|
||||||
|
if (wp != NULL &&
|
||||||
|
(wp->flags & PANE_EXITED) &&
|
||||||
|
!KEYC_IS_MOUSE(key) &&
|
||||||
|
!KEYC_IS_PASTE(key) &&
|
||||||
|
options_get_number(wp->options, "remain-on-exit") == 3) {
|
||||||
|
options_set_number(wp->options, "remain-on-exit", 0);
|
||||||
|
server_destroy_pane(wp, 0);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
if (c->flags & CLIENT_READONLY)
|
if (c->flags & CLIENT_READONLY)
|
||||||
goto out;
|
goto out;
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ server_destroy_pane(struct window_pane *wp, int notify)
|
|||||||
break;
|
break;
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case 1:
|
case 1:
|
||||||
|
case 3:
|
||||||
if (wp->flags & PANE_STATUSDRAWN)
|
if (wp->flags & PANE_STATUSDRAWN)
|
||||||
return;
|
return;
|
||||||
wp->flags |= PANE_STATUSDRAWN;
|
wp->flags |= PANE_STATUSDRAWN;
|
||||||
|
|||||||
8
tmux.1
8
tmux.1
@@ -5571,13 +5571,16 @@ uses when the colour with that index is requested.
|
|||||||
The index may be from zero to 255.
|
The index may be from zero to 255.
|
||||||
.Pp
|
.Pp
|
||||||
.It Xo Ic remain\-on\-exit
|
.It Xo Ic remain\-on\-exit
|
||||||
.Op Ic on | off | failed
|
.Op Ic on | off | failed | key
|
||||||
.Xc
|
.Xc
|
||||||
A pane with this flag set is not destroyed when the program running in it
|
A pane with this flag set is not destroyed when the program running in it
|
||||||
exits.
|
exits.
|
||||||
If set to
|
If set to
|
||||||
.Ic failed ,
|
.Ic failed ,
|
||||||
then only when the program exit status is not zero.
|
then only when the program exit status is not zero.
|
||||||
|
If set to
|
||||||
|
.Ic key ,
|
||||||
|
the pane stays open and closes when a key is pressed.
|
||||||
The pane may be reactivated with the
|
The pane may be reactivated with the
|
||||||
.Ic respawn\-pane
|
.Ic respawn\-pane
|
||||||
command.
|
command.
|
||||||
@@ -6371,6 +6374,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_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_dead_time" Ta "" Ta "Exit time of process in dead pane"
|
||||||
.It Li "pane_fg" Ta "" Ta "Pane foreground colour"
|
.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_format" Ta "" Ta "1 if format is for a pane"
|
||||||
.It Li "pane_height" Ta "" Ta "Height of pane"
|
.It Li "pane_height" Ta "" Ta "Height of pane"
|
||||||
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
|
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
|
||||||
@@ -6400,6 +6405,7 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane"
|
.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_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_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 "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_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"
|
.It Li "prev_window_index" Ta "" Ta "Index of previous window in W: loop"
|
||||||
|
|||||||
6
tmux.h
6
tmux.h
@@ -1250,7 +1250,7 @@ struct window_pane {
|
|||||||
#define PANE_FOCUSED 0x4
|
#define PANE_FOCUSED 0x4
|
||||||
#define PANE_VISITED 0x8
|
#define PANE_VISITED 0x8
|
||||||
#define PANE_ZOOMED 0x10
|
#define PANE_ZOOMED 0x10
|
||||||
/* 0x20 unused */
|
#define PANE_FLOATING 0x20
|
||||||
#define PANE_INPUTOFF 0x40
|
#define PANE_INPUTOFF 0x40
|
||||||
#define PANE_CHANGED 0x80
|
#define PANE_CHANGED 0x80
|
||||||
#define PANE_EXITED 0x100
|
#define PANE_EXITED 0x100
|
||||||
@@ -1993,6 +1993,7 @@ typedef void (*overlay_resize_cb)(struct client *, void *);
|
|||||||
struct client {
|
struct client {
|
||||||
const char *name;
|
const char *name;
|
||||||
struct tmuxpeer *peer;
|
struct tmuxpeer *peer;
|
||||||
|
const char *user;
|
||||||
struct cmdq_list *queue;
|
struct cmdq_list *queue;
|
||||||
|
|
||||||
struct client_windows windows;
|
struct client_windows windows;
|
||||||
@@ -3421,6 +3422,7 @@ int window_pane_exited(struct window_pane *);
|
|||||||
u_int window_pane_search(struct window_pane *, const char *, int,
|
u_int window_pane_search(struct window_pane *, const char *, int,
|
||||||
int);
|
int);
|
||||||
const char *window_printable_flags(struct winlink *, 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_up(struct window_pane *);
|
||||||
struct window_pane *window_pane_find_down(struct window_pane *);
|
struct window_pane *window_pane_find_down(struct window_pane *);
|
||||||
struct window_pane *window_pane_find_left(struct window_pane *);
|
struct window_pane *window_pane_find_left(struct window_pane *);
|
||||||
@@ -3488,7 +3490,7 @@ int layout_spread_cell(struct window *, struct layout_cell *);
|
|||||||
void layout_spread_out(struct window_pane *);
|
void layout_spread_out(struct window_pane *);
|
||||||
|
|
||||||
/* layout-custom.c */
|
/* 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 **);
|
int layout_parse(struct window *, const char *, char **);
|
||||||
|
|
||||||
/* layout-set.c */
|
/* layout-set.c */
|
||||||
|
|||||||
22
window.c
22
window.c
@@ -889,9 +889,8 @@ window_printable_flags(struct winlink *wl, int escape)
|
|||||||
{
|
{
|
||||||
struct session *s = wl->session;
|
struct session *s = wl->session;
|
||||||
static char flags[32];
|
static char flags[32];
|
||||||
int pos;
|
u_int pos = 0;
|
||||||
|
|
||||||
pos = 0;
|
|
||||||
if (wl->flags & WINLINK_ACTIVITY) {
|
if (wl->flags & WINLINK_ACTIVITY) {
|
||||||
flags[pos++] = '#';
|
flags[pos++] = '#';
|
||||||
if (escape)
|
if (escape)
|
||||||
@@ -913,6 +912,25 @@ window_printable_flags(struct winlink *wl, int escape)
|
|||||||
return (flags);
|
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 *
|
struct window_pane *
|
||||||
window_pane_find_by_id_str(const char *s)
|
window_pane_find_by_id_str(const char *s)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user