mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Flush even detached sessions.
This commit is contained in:
parent
8dbccbc4db
commit
438144692d
6
NOTES
6
NOTES
@ -27,6 +27,8 @@ Attach to a previous session with:
|
|||||||
|
|
||||||
tmux -n <session name> attach
|
tmux -n <session name> attach
|
||||||
|
|
||||||
|
A name must (currently) be specified when attaching. This may change.
|
||||||
|
|
||||||
List all sessions with:
|
List all sessions with:
|
||||||
|
|
||||||
tmux list
|
tmux list
|
||||||
@ -37,8 +39,8 @@ Or the windows of a single session with:
|
|||||||
|
|
||||||
Sessions are destroyed when no windows remain attached to them.
|
Sessions are destroyed when no windows remain attached to them.
|
||||||
|
|
||||||
Another server process can be used by specifying an alternative socket path with
|
Another server process can be used by specifying an alternative socket path
|
||||||
"-s <path>" but it shouldn't normally be required.
|
with "-s <path>" but it shouldn't normally be required.
|
||||||
|
|
||||||
You can set the window title (listed in -l), using the \e] escape sequence. For
|
You can set the window title (listed in -l), using the \e] escape sequence. For
|
||||||
example:
|
example:
|
||||||
|
1
TODO
1
TODO
@ -12,3 +12,4 @@
|
|||||||
- wrap windows with forward/back
|
- wrap windows with forward/back
|
||||||
- new window command prompt
|
- new window command prompt
|
||||||
- mouse handling and some other bits elinks needs
|
- mouse handling and some other bits elinks needs
|
||||||
|
- scrollback
|
||||||
|
28
server.c
28
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.6 2007-08-27 13:45:26 nicm Exp $ */
|
/* $Id: server.c,v 1.7 2007-08-27 15:28:07 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -658,31 +658,29 @@ lost_window(struct window *w)
|
|||||||
struct client *c;
|
struct client *c;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
u_int i, j;
|
u_int i, j;
|
||||||
|
int destroyed;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||||
c = ARRAY_ITEM(&clients, i);
|
s = ARRAY_ITEM(&sessions, i);
|
||||||
if (c == NULL || c->session == NULL)
|
if (s == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (!session_has(c->session, w))
|
if (!session_has(s, w))
|
||||||
continue;
|
continue;
|
||||||
s = c->session;
|
|
||||||
|
|
||||||
/* Detach window from session. */
|
/* Detach window from session. */
|
||||||
session_detach(s, w);
|
session_detach(s, w);
|
||||||
|
|
||||||
/* Try to flush session and redraw if not destroyed. */
|
/* Try to flush session and either redraw or kill clients. */
|
||||||
if (session_flush(s) == 0) {
|
destroyed = session_flush(s);
|
||||||
changed_window(c);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kill all clients attached to this session. */
|
|
||||||
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
||||||
c = ARRAY_ITEM(&clients, j);
|
c = ARRAY_ITEM(&clients, j);
|
||||||
if (c == NULL || c->session != s)
|
if (c == NULL || c->session != s)
|
||||||
continue;
|
continue;
|
||||||
c->session = NULL;
|
if (destroyed) {
|
||||||
write_client(c, MSG_EXIT, NULL, 0);
|
c->session = NULL;
|
||||||
|
write_client(c, MSG_EXIT, NULL, 0);
|
||||||
|
} else
|
||||||
|
changed_window(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: session.c,v 1.5 2007-08-27 13:45:26 nicm Exp $ */
|
/* $Id: session.c,v 1.6 2007-08-27 15:28:07 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -70,7 +70,7 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy)
|
|||||||
if (*name != '\0')
|
if (*name != '\0')
|
||||||
strlcpy(s->name, name, sizeof s->name);
|
strlcpy(s->name, name, sizeof s->name);
|
||||||
else
|
else
|
||||||
xsnprintf(s->name, sizeof s->name, "session-%u", i);
|
xsnprintf(s->name, sizeof s->name, "%u", i);
|
||||||
|
|
||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user