version 1.32, 2016/03/03 14:14:46 |
version 1.33, 2016/10/10 21:51:39 |
|
|
|
|
#include "tmux.h" |
#include "tmux.h" |
|
|
struct session *cmd_find_try_TMUX(struct client *, struct window *); |
static struct session *cmd_find_try_TMUX(struct client *, struct window *); |
int cmd_find_client_better(struct client *, struct client *); |
static int cmd_find_client_better(struct client *, struct client *); |
struct client *cmd_find_best_client(struct client **, u_int); |
static struct client *cmd_find_best_client(struct client **, u_int); |
int cmd_find_session_better(struct session *, struct session *, |
static int cmd_find_session_better(struct session *, struct session *, |
int); |
int); |
struct session *cmd_find_best_session(struct session **, u_int, int); |
static struct session *cmd_find_best_session(struct session **, u_int, int); |
int cmd_find_best_session_with_window(struct cmd_find_state *); |
static int cmd_find_best_session_with_window(struct cmd_find_state *); |
int cmd_find_best_winlink_with_window(struct cmd_find_state *); |
static int cmd_find_best_winlink_with_window(struct cmd_find_state *); |
|
|
int cmd_find_current_session_with_client(struct cmd_find_state *); |
static int cmd_find_current_session_with_client(struct cmd_find_state *); |
int cmd_find_current_session(struct cmd_find_state *); |
static int cmd_find_current_session(struct cmd_find_state *); |
struct client *cmd_find_current_client(struct cmd_q *); |
static struct client *cmd_find_current_client(struct cmd_q *); |
|
|
const char *cmd_find_map_table(const char *[][2], const char *); |
static const char *cmd_find_map_table(const char *[][2], const char *); |
|
|
int cmd_find_get_session(struct cmd_find_state *, const char *); |
static int cmd_find_get_session(struct cmd_find_state *, const char *); |
int cmd_find_get_window(struct cmd_find_state *, const char *); |
static int cmd_find_get_window(struct cmd_find_state *, const char *); |
int cmd_find_get_window_with_session(struct cmd_find_state *, const char *); |
static int cmd_find_get_window_with_session(struct cmd_find_state *, |
int cmd_find_get_window_with_pane(struct cmd_find_state *); |
const char *); |
int cmd_find_get_pane(struct cmd_find_state *, const char *); |
static int cmd_find_get_pane(struct cmd_find_state *, const char *); |
int cmd_find_get_pane_with_session(struct cmd_find_state *, const char *); |
static int cmd_find_get_pane_with_session(struct cmd_find_state *, |
int cmd_find_get_pane_with_window(struct cmd_find_state *, const char *); |
const char *); |
|
static int cmd_find_get_pane_with_window(struct cmd_find_state *, |
|
const char *); |
|
|
const char *cmd_find_session_table[][2] = { |
static const char *cmd_find_session_table[][2] = { |
{ NULL, NULL } |
{ NULL, NULL } |
}; |
}; |
const char *cmd_find_window_table[][2] = { |
static const char *cmd_find_window_table[][2] = { |
{ "{start}", "^" }, |
{ "{start}", "^" }, |
{ "{last}", "!" }, |
{ "{last}", "!" }, |
{ "{end}", "$" }, |
{ "{end}", "$" }, |
|
|
{ "{previous}", "-" }, |
{ "{previous}", "-" }, |
{ NULL, NULL } |
{ NULL, NULL } |
}; |
}; |
const char *cmd_find_pane_table[][2] = { |
static const char *cmd_find_pane_table[][2] = { |
{ "{last}", "!" }, |
{ "{last}", "!" }, |
{ "{next}", "+" }, |
{ "{next}", "+" }, |
{ "{previous}", "-" }, |
{ "{previous}", "-" }, |
|
|
}; |
}; |
|
|
/* Get session from TMUX if present. */ |
/* Get session from TMUX if present. */ |
struct session * |
static struct session * |
cmd_find_try_TMUX(struct client *c, struct window *w) |
cmd_find_try_TMUX(struct client *c, struct window *w) |
{ |
{ |
struct environ_entry *envent; |
struct environ_entry *envent; |
|
|
} |
} |
|
|
/* Is this client better? */ |
/* Is this client better? */ |
int |
static int |
cmd_find_client_better(struct client *c, struct client *than) |
cmd_find_client_better(struct client *c, struct client *than) |
{ |
{ |
if (than == NULL) |
if (than == NULL) |
|
|
} |
} |
|
|
/* Find best client from a list, or all if list is NULL. */ |
/* Find best client from a list, or all if list is NULL. */ |
struct client * |
static struct client * |
cmd_find_best_client(struct client **clist, u_int csize) |
cmd_find_best_client(struct client **clist, u_int csize) |
{ |
{ |
struct client *c_loop, *c; |
struct client *c_loop, *c; |
|
|
} |
} |
|
|
/* Is this session better? */ |
/* Is this session better? */ |
int |
static int |
cmd_find_session_better(struct session *s, struct session *than, int flags) |
cmd_find_session_better(struct session *s, struct session *than, int flags) |
{ |
{ |
int attached; |
int attached; |
|
|
} |
} |
|
|
/* Find best session from a list, or all if list is NULL. */ |
/* Find best session from a list, or all if list is NULL. */ |
struct session * |
static struct session * |
cmd_find_best_session(struct session **slist, u_int ssize, int flags) |
cmd_find_best_session(struct session **slist, u_int ssize, int flags) |
{ |
{ |
struct session *s_loop, *s; |
struct session *s_loop, *s; |
|
|
} |
} |
|
|
/* Find best session and winlink for window. */ |
/* Find best session and winlink for window. */ |
int |
static int |
cmd_find_best_session_with_window(struct cmd_find_state *fs) |
cmd_find_best_session_with_window(struct cmd_find_state *fs) |
{ |
{ |
struct session **slist = NULL; |
struct session **slist = NULL; |
|
|
* Find the best winlink for a window (the current if it contains the pane, |
* Find the best winlink for a window (the current if it contains the pane, |
* otherwise the first). |
* otherwise the first). |
*/ |
*/ |
int |
static int |
cmd_find_best_winlink_with_window(struct cmd_find_state *fs) |
cmd_find_best_winlink_with_window(struct cmd_find_state *fs) |
{ |
{ |
struct winlink *wl, *wl_loop; |
struct winlink *wl, *wl_loop; |
|
|
} |
} |
|
|
/* Find current session when we have an unattached client. */ |
/* Find current session when we have an unattached client. */ |
int |
static int |
cmd_find_current_session_with_client(struct cmd_find_state *fs) |
cmd_find_current_session_with_client(struct cmd_find_state *fs) |
{ |
{ |
struct window_pane *wp; |
struct window_pane *wp; |
|
|
* Work out the best current state. If this function succeeds, the state is |
* Work out the best current state. If this function succeeds, the state is |
* guaranteed to be completely filled in. |
* guaranteed to be completely filled in. |
*/ |
*/ |
int |
static int |
cmd_find_current_session(struct cmd_find_state *fs) |
cmd_find_current_session(struct cmd_find_state *fs) |
{ |
{ |
/* If we know the current client, use it. */ |
/* If we know the current client, use it. */ |
|
|
} |
} |
|
|
/* Work out the best current client. */ |
/* Work out the best current client. */ |
struct client * |
static struct client * |
cmd_find_current_client(struct cmd_q *cmdq) |
cmd_find_current_client(struct cmd_q *cmdq) |
{ |
{ |
struct cmd_find_state current; |
struct cmd_find_state current; |
|
|
} |
} |
|
|
/* Maps string in table. */ |
/* Maps string in table. */ |
const char * |
static const char * |
cmd_find_map_table(const char *table[][2], const char *s) |
cmd_find_map_table(const char *table[][2], const char *s) |
{ |
{ |
u_int i; |
u_int i; |
|
|
} |
} |
|
|
/* Find session from string. Fills in s. */ |
/* Find session from string. Fills in s. */ |
int |
static int |
cmd_find_get_session(struct cmd_find_state *fs, const char *session) |
cmd_find_get_session(struct cmd_find_state *fs, const char *session) |
{ |
{ |
struct session *s, *s_loop; |
struct session *s, *s_loop; |
|
|
} |
} |
|
|
/* Find window from string. Fills in s, wl, w. */ |
/* Find window from string. Fills in s, wl, w. */ |
int |
static int |
cmd_find_get_window(struct cmd_find_state *fs, const char *window) |
cmd_find_get_window(struct cmd_find_state *fs, const char *window) |
{ |
{ |
log_debug("%s: %s", __func__, window); |
log_debug("%s: %s", __func__, window); |
|
|
* Find window from string, assuming it is in given session. Needs s, fills in |
* Find window from string, assuming it is in given session. Needs s, fills in |
* wl and w. |
* wl and w. |
*/ |
*/ |
int |
static int |
cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) |
cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window) |
{ |
{ |
struct winlink *wl; |
struct winlink *wl; |
|
|
return (-1); |
return (-1); |
} |
} |
|
|
/* Find window from given pane. Needs wp, fills in s and wl and w. */ |
|
int |
|
cmd_find_get_window_with_pane(struct cmd_find_state *fs) |
|
{ |
|
log_debug("%s", __func__); |
|
|
|
fs->w = fs->wp->window; |
|
return (cmd_find_best_session_with_window(fs)); |
|
} |
|
|
|
/* Find pane from string. Fills in s, wl, w, wp. */ |
/* Find pane from string. Fills in s, wl, w, wp. */ |
int |
static int |
cmd_find_get_pane(struct cmd_find_state *fs, const char *pane) |
cmd_find_get_pane(struct cmd_find_state *fs, const char *pane) |
{ |
{ |
log_debug("%s: %s", __func__, pane); |
log_debug("%s: %s", __func__, pane); |
|
|
* Find pane from string, assuming it is in given session. Needs s, fills in wl |
* Find pane from string, assuming it is in given session. Needs s, fills in wl |
* and w and wp. |
* and w and wp. |
*/ |
*/ |
int |
static int |
cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane) |
cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane) |
{ |
{ |
log_debug("%s: %s", __func__, pane); |
log_debug("%s: %s", __func__, pane); |
|
|
* Find pane from string, assuming it is in the given window. Needs w, fills in |
* Find pane from string, assuming it is in the given window. Needs w, fills in |
* wp. |
* wp. |
*/ |
*/ |
int |
static int |
cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane) |
cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane) |
{ |
{ |
const char *errstr; |
const char *errstr; |