mirror of
https://github.com/tmux/tmux.git
synced 2025-01-08 08:58:47 +00:00
Wrap next/prev.
This commit is contained in:
parent
b1782e1b3d
commit
9c0b51cd5d
6
CHANGES
6
CHANGES
@ -1,3 +1,7 @@
|
|||||||
|
20 September 2007
|
||||||
|
|
||||||
|
* Wrap on next/previous. From Maximilian Gass.
|
||||||
|
|
||||||
19 September 2007
|
19 September 2007
|
||||||
|
|
||||||
* Don't renumber windows on close.
|
* Don't renumber windows on close.
|
||||||
@ -20,5 +24,5 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.5 2007-09-19 15:16:23 nicm Exp $
|
$Id: CHANGES,v 1.6 2007-09-20 08:21:59 nicm Exp $
|
||||||
|
|
||||||
|
19
session.c
19
session.c
@ -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>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -155,13 +155,19 @@ int
|
|||||||
session_next(struct session *s)
|
session_next(struct session *s)
|
||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
|
u_int n;
|
||||||
|
|
||||||
if (s->window == NULL)
|
if (s->window == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
w = window_next(&s->windows, s->window);
|
w = window_next(&s->windows, s->window);
|
||||||
if (w == NULL)
|
if (w == NULL) {
|
||||||
return (-1);
|
n = 0;
|
||||||
|
while ((w = ARRAY_ITEM(&s->windows, n)) == NULL)
|
||||||
|
n++;
|
||||||
|
if (w == s->window)
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
s->window = w;
|
s->window = w;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -176,8 +182,11 @@ session_previous(struct session *s)
|
|||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
w = window_previous(&s->windows, s->window);
|
w = window_previous(&s->windows, s->window);
|
||||||
if (w == NULL)
|
if (w == NULL) {
|
||||||
return (-1);
|
w = ARRAY_LAST(&s->windows);
|
||||||
|
if (w == s->window)
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
s->window = w;
|
s->window = w;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user