summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES7
-rw-r--r--TODO2
-rw-r--r--server.c24
-rw-r--r--session.c18
-rw-r--r--tmux.h13
5 files changed, 50 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 96a2cd35..0cb36349 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+06 June 2008
+
+* The server now exits when no sessions remain.
+* Fix bug with inserting characters with TERM=xterm-color.
+
05 June 2008
* Completely reorganise command parsing. Much more common code in cmd-generic.c
@@ -440,4 +445,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.113 2008-06-05 23:17:03 nicm Exp $
+$Id: CHANGES,v 1.114 2008-06-06 17:55:27 nicm Exp $
diff --git a/TODO b/TODO
index ad78ee4f..f3e2d633 100644
--- a/TODO
+++ b/TODO
@@ -79,6 +79,6 @@
- status bar customisation variables, show-activity, show-last-window
- show-options
- let server die when last session does
-- each command should have a print op as well for list keys
- fix occasion start server problems
+- key binding bug: random changes?
- test and fix wsvt25
diff --git a/server.c b/server.c
index cda95dde..0d20b298 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.54 2008-06-06 17:20:29 nicm Exp $ */
+/* $Id: server.c,v 1.55 2008-06-06 17:55:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -142,7 +142,7 @@ server_main(const char *srv_path, int srv_fd)
{
struct pollfd *pfds, *pfd;
int nfds;
- u_int i;
+ u_int i, n;
siginit();
@@ -188,6 +188,22 @@ server_main(const char *srv_path, int srv_fd)
*/
server_handle_windows(&pfd);
server_handle_clients(&pfd);
+
+ /*
+ * If we have no sessions and clients left, let's get out
+ * of here...
+ */
+ n = 0;
+ for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
+ if (ARRAY_ITEM(&sessions, i) != NULL)
+ n++;
+ }
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ if (ARRAY_ITEM(&clients, i) != NULL)
+ n++;
+ }
+ if (n == 0)
+ break;
}
if (pfds != NULL)
xfree(pfds);
@@ -430,7 +446,7 @@ server_handle_window(struct window *w)
continue;
if (w->flags & WINDOW_BELL &&
- !session_alert_has(s, w, WINDOW_BELL)) {
+ !session_alert_has_window(s, w, WINDOW_BELL)) {
session_alert_add(s, w, WINDOW_BELL);
action = options_get_number(&s->options, "bell-action");
@@ -449,7 +465,7 @@ server_handle_window(struct window *w)
if ((w->flags & WINDOW_MONITOR) &&
(w->flags & WINDOW_ACTIVITY) &&
- !session_alert_has(s, w, WINDOW_ACTIVITY)) {
+ !session_alert_has_window(s, w, WINDOW_ACTIVITY)) {
session_alert_add(s, w, WINDOW_ACTIVITY);
update = 1;
}
diff --git a/session.c b/session.c
index c2680492..8ab0c819 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $Id: session.c,v 1.35 2008-06-06 17:20:29 nicm Exp $ */
+/* $Id: session.c,v 1.36 2008-06-06 17:55:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -55,7 +55,8 @@ session_alert_add(struct session *s, struct window *w, int type)
if (wl == s->curw)
continue;
- if (wl->window == w && !session_alert_has(s, wl, type)) {
+ if (wl->window == w &&
+ !session_alert_has(s, wl, type)) {
sa = xmalloc(sizeof *sa);
sa->wl = wl;
sa->type = type;
@@ -77,6 +78,19 @@ session_alert_has(struct session *s, struct winlink *wl, int type)
return (0);
}
+int
+session_alert_has_window(struct session *s, struct window *w, int type)
+{
+ struct session_alert *sa;
+
+ TAILQ_FOREACH(sa, &s->alerts, entry) {
+ if (sa->wl->window == w && sa->type == type)
+ return (1);
+ }
+
+ return (0);
+}
+
/* Find session by name. */
struct session *
session_find(const char *name)
diff --git a/tmux.h b/tmux.h
index de2fafd6..8778030e 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.134 2008-06-06 17:20:30 nicm Exp $ */
+/* $Id: tmux.h,v 1.135 2008-06-06 17:55:27 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1061,13 +1061,14 @@ void printflike2 window_more_add(struct window *, const char *, ...);
/* session.c */
extern struct sessions sessions;
-void session_alert_add(struct session *, struct window *, int);
-void session_alert_cancel(struct session *, struct winlink *);
-int session_alert_has(struct session *, struct winlink *, int);
+void session_alert_add(struct session *, struct window *, int);
+void session_alert_cancel(struct session *, struct winlink *);
+int session_alert_has(struct session *, struct winlink *, int);
+int session_alert_has_window(struct session *, struct window *, int);
struct session *session_find(const char *);
struct session *session_create(const char *, const char *, u_int, u_int);
-void session_destroy(struct session *);
-int session_index(struct session *, u_int *);
+void session_destroy(struct session *);
+int session_index(struct session *, u_int *);
struct winlink *session_new(struct session *, const char *, const char *, int);
struct winlink *session_attach(struct session *, struct window *, int);
int session_detach(struct session *, struct winlink *);