mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Fix next and previous session functions to actually work.
This commit is contained in:
parent
96ab50a701
commit
588ebb5393
18
session.c
18
session.c
@ -181,12 +181,9 @@ session_next_session(struct session *s)
|
|||||||
if (RB_EMPTY(&sessions) || !session_alive(s))
|
if (RB_EMPTY(&sessions) || !session_alive(s))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
s2 = s;
|
s2 = RB_NEXT(sessions, &sessions, s2);
|
||||||
do {
|
if (s2 == NULL)
|
||||||
s2 = RB_NEXT(sessions, &sessions, s2);
|
s2 = RB_MIN(sessions, &sessions);
|
||||||
if (s2 == NULL)
|
|
||||||
s2 = RB_MIN(sessions, &sessions);
|
|
||||||
} while (s2 != s);
|
|
||||||
if (s2 == s)
|
if (s2 == s)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
return (s2);
|
return (s2);
|
||||||
@ -201,12 +198,9 @@ session_previous_session(struct session *s)
|
|||||||
if (RB_EMPTY(&sessions) || !session_alive(s))
|
if (RB_EMPTY(&sessions) || !session_alive(s))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
s2 = s;
|
s2 = RB_PREV(sessions, &sessions, s2);
|
||||||
do {
|
if (s2 == NULL)
|
||||||
s2 = RB_PREV(sessions, &sessions, s2);
|
s2 = RB_MAX(sessions, &sessions);
|
||||||
if (s2 == NULL)
|
|
||||||
s2 = RB_MAX(sessions, &sessions);
|
|
||||||
} while (s2 != s);
|
|
||||||
if (s2 == s)
|
if (s2 == s)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
return (s2);
|
return (s2);
|
||||||
|
Loading…
Reference in New Issue
Block a user