diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-20 08:21:59 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-20 08:21:59 +0000 |
commit | 9c0b51cd5df342aa96048948d42323df6e6d3dc0 (patch) | |
tree | f49e281f4971bf9ce22ac981210db2bd21c870c1 /session.c | |
parent | b1782e1b3d2df83c68314427d4ea65e4e14698eb (diff) | |
download | rtmux-9c0b51cd5df342aa96048948d42323df6e6d3dc0.tar.gz rtmux-9c0b51cd5df342aa96048948d42323df6e6d3dc0.tar.bz2 rtmux-9c0b51cd5df342aa96048948d42323df6e6d3dc0.zip |
Wrap next/prev.
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.7 2007-08-27 20:36:52 nicm Exp $ */ +/* $Id: session.c,v 1.8 2007-09-20 08:21:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -155,13 +155,19 @@ int session_next(struct session *s) { struct window *w; + u_int n; if (s->window == NULL) return (-1); w = window_next(&s->windows, s->window); - if (w == NULL) - return (-1); + if (w == NULL) { + n = 0; + while ((w = ARRAY_ITEM(&s->windows, n)) == NULL) + n++; + if (w == s->window) + return (1); + } s->window = w; return (0); } @@ -176,8 +182,11 @@ session_previous(struct session *s) return (-1); w = window_previous(&s->windows, s->window); - if (w == NULL) - return (-1); + if (w == NULL) { + w = ARRAY_LAST(&s->windows); + if (w == s->window) + return (1); + } s->window = w; return (0); } |