mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Make session_has return a flag, returning the first winlink found is a
recipe for errors.
This commit is contained in:
parent
8d66f4fba4
commit
9a453dd354
2
resize.c
2
resize.c
@ -104,7 +104,7 @@ recalculate_sizes(void)
|
|||||||
if (flag)
|
if (flag)
|
||||||
has = s->curw->window == w;
|
has = s->curw->window == w;
|
||||||
else
|
else
|
||||||
has = session_has(s, w) != NULL;
|
has = session_has(s, w);
|
||||||
if (has) {
|
if (has) {
|
||||||
if (s->sx < ssx)
|
if (s->sx < ssx)
|
||||||
ssx = s->sx;
|
ssx = s->sx;
|
||||||
|
@ -199,7 +199,7 @@ server_status_window(struct window *w)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
RB_FOREACH(s, sessions, &sessions) {
|
RB_FOREACH(s, sessions, &sessions) {
|
||||||
if (session_has(s, w) != NULL)
|
if (session_has(s, w))
|
||||||
server_status_session(s);
|
server_status_session(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ server_kill_window(struct window *w)
|
|||||||
s = next_s;
|
s = next_s;
|
||||||
next_s = RB_NEXT(sessions, &sessions, s);
|
next_s = RB_NEXT(sessions, &sessions, s);
|
||||||
|
|
||||||
if (session_has(s, w) == NULL)
|
if (!session_has(s, w))
|
||||||
continue;
|
continue;
|
||||||
server_unzoom_window(w);
|
server_unzoom_window(w);
|
||||||
while ((wl = winlink_find_by_window(&s->windows, w)) != NULL) {
|
while ((wl = winlink_find_by_window(&s->windows, w)) != NULL) {
|
||||||
|
@ -309,16 +309,16 @@ session_detach(struct session *s, struct winlink *wl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return if session has window. */
|
/* Return if session has window. */
|
||||||
struct winlink *
|
int
|
||||||
session_has(struct session *s, struct window *w)
|
session_has(struct session *s, struct window *w)
|
||||||
{
|
{
|
||||||
struct winlink *wl;
|
struct winlink *wl;
|
||||||
|
|
||||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||||
if (wl->window == w)
|
if (wl->window == w)
|
||||||
return (wl);
|
return (1);
|
||||||
}
|
}
|
||||||
return (NULL);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct winlink *
|
struct winlink *
|
||||||
|
2
tmux.h
2
tmux.h
@ -2321,7 +2321,7 @@ struct winlink *session_new(struct session *, const char *, int, char **,
|
|||||||
struct winlink *session_attach(struct session *, struct window *, int,
|
struct winlink *session_attach(struct session *, struct window *, int,
|
||||||
char **);
|
char **);
|
||||||
int session_detach(struct session *, struct winlink *);
|
int session_detach(struct session *, struct winlink *);
|
||||||
struct winlink *session_has(struct session *, struct window *);
|
int session_has(struct session *, struct window *);
|
||||||
int session_next(struct session *, int);
|
int session_next(struct session *, int);
|
||||||
int session_previous(struct session *, int);
|
int session_previous(struct session *, int);
|
||||||
int session_select(struct session *, int);
|
int session_select(struct session *, int);
|
||||||
|
Loading…
Reference in New Issue
Block a user