mirror of
https://github.com/tmux/tmux.git
synced 2025-09-06 11:28:24 +00:00
Merge branch 'obsd-master'
Conflicts: format.c osdep-openbsd.c
This commit is contained in:
90
cmd-find.c
90
cmd-find.c
@@ -26,33 +26,35 @@
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
struct session *cmd_find_try_TMUX(struct client *, struct window *);
|
||||
int cmd_find_client_better(struct client *, struct client *);
|
||||
struct client *cmd_find_best_client(struct client **, u_int);
|
||||
int cmd_find_session_better(struct session *, struct session *,
|
||||
int);
|
||||
struct session *cmd_find_best_session(struct session **, u_int, int);
|
||||
int cmd_find_best_session_with_window(struct cmd_find_state *);
|
||||
int cmd_find_best_winlink_with_window(struct cmd_find_state *);
|
||||
static struct session *cmd_find_try_TMUX(struct client *, struct window *);
|
||||
static int cmd_find_client_better(struct client *, struct client *);
|
||||
static struct client *cmd_find_best_client(struct client **, u_int);
|
||||
static int cmd_find_session_better(struct session *, struct session *,
|
||||
int);
|
||||
static struct session *cmd_find_best_session(struct session **, u_int, int);
|
||||
static int cmd_find_best_session_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 *);
|
||||
int cmd_find_current_session(struct cmd_find_state *);
|
||||
struct client *cmd_find_current_client(struct cmd_q *);
|
||||
static int cmd_find_current_session_with_client(struct cmd_find_state *);
|
||||
static int cmd_find_current_session(struct cmd_find_state *);
|
||||
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 *);
|
||||
int cmd_find_get_window(struct cmd_find_state *, const char *);
|
||||
int cmd_find_get_window_with_session(struct cmd_find_state *, const char *);
|
||||
int cmd_find_get_window_with_pane(struct cmd_find_state *);
|
||||
int cmd_find_get_pane(struct cmd_find_state *, const char *);
|
||||
int cmd_find_get_pane_with_session(struct cmd_find_state *, const char *);
|
||||
int cmd_find_get_pane_with_window(struct cmd_find_state *, const char *);
|
||||
static int cmd_find_get_session(struct cmd_find_state *, const char *);
|
||||
static int cmd_find_get_window(struct cmd_find_state *, const char *);
|
||||
static int cmd_find_get_window_with_session(struct cmd_find_state *,
|
||||
const char *);
|
||||
static int cmd_find_get_pane(struct cmd_find_state *, const char *);
|
||||
static int cmd_find_get_pane_with_session(struct cmd_find_state *,
|
||||
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 }
|
||||
};
|
||||
const char *cmd_find_window_table[][2] = {
|
||||
static const char *cmd_find_window_table[][2] = {
|
||||
{ "{start}", "^" },
|
||||
{ "{last}", "!" },
|
||||
{ "{end}", "$" },
|
||||
@@ -60,7 +62,7 @@ const char *cmd_find_window_table[][2] = {
|
||||
{ "{previous}", "-" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
const char *cmd_find_pane_table[][2] = {
|
||||
static const char *cmd_find_pane_table[][2] = {
|
||||
{ "{last}", "!" },
|
||||
{ "{next}", "+" },
|
||||
{ "{previous}", "-" },
|
||||
@@ -80,7 +82,7 @@ const char *cmd_find_pane_table[][2] = {
|
||||
};
|
||||
|
||||
/* Get session from TMUX if present. */
|
||||
struct session *
|
||||
static struct session *
|
||||
cmd_find_try_TMUX(struct client *c, struct window *w)
|
||||
{
|
||||
struct environ_entry *envent;
|
||||
@@ -107,7 +109,7 @@ cmd_find_try_TMUX(struct client *c, struct window *w)
|
||||
}
|
||||
|
||||
/* Is this client better? */
|
||||
int
|
||||
static int
|
||||
cmd_find_client_better(struct client *c, struct client *than)
|
||||
{
|
||||
if (than == NULL)
|
||||
@@ -116,7 +118,7 @@ cmd_find_client_better(struct client *c, struct client *than)
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
struct client *c_loop, *c;
|
||||
@@ -142,7 +144,7 @@ cmd_find_best_client(struct client **clist, u_int csize)
|
||||
}
|
||||
|
||||
/* Is this session better? */
|
||||
int
|
||||
static int
|
||||
cmd_find_session_better(struct session *s, struct session *than, int flags)
|
||||
{
|
||||
int attached;
|
||||
@@ -160,7 +162,7 @@ cmd_find_session_better(struct session *s, struct session *than, int flags)
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
struct session *s_loop, *s;
|
||||
@@ -182,7 +184,7 @@ cmd_find_best_session(struct session **slist, u_int ssize, int flags)
|
||||
}
|
||||
|
||||
/* Find best session and winlink for window. */
|
||||
int
|
||||
static int
|
||||
cmd_find_best_session_with_window(struct cmd_find_state *fs)
|
||||
{
|
||||
struct session **slist = NULL;
|
||||
@@ -219,7 +221,7 @@ fail:
|
||||
* Find the best winlink for a window (the current if it contains the pane,
|
||||
* otherwise the first).
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cmd_find_best_winlink_with_window(struct cmd_find_state *fs)
|
||||
{
|
||||
struct winlink *wl, *wl_loop;
|
||||
@@ -243,7 +245,7 @@ cmd_find_best_winlink_with_window(struct cmd_find_state *fs)
|
||||
}
|
||||
|
||||
/* Find current session when we have an unattached client. */
|
||||
int
|
||||
static int
|
||||
cmd_find_current_session_with_client(struct cmd_find_state *fs)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
@@ -307,7 +309,7 @@ unknown_pane:
|
||||
* Work out the best current state. If this function succeeds, the state is
|
||||
* guaranteed to be completely filled in.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cmd_find_current_session(struct cmd_find_state *fs)
|
||||
{
|
||||
/* If we know the current client, use it. */
|
||||
@@ -337,7 +339,7 @@ cmd_find_current_session(struct cmd_find_state *fs)
|
||||
}
|
||||
|
||||
/* Work out the best current client. */
|
||||
struct client *
|
||||
static struct client *
|
||||
cmd_find_current_client(struct cmd_q *cmdq)
|
||||
{
|
||||
struct cmd_find_state current;
|
||||
@@ -383,7 +385,7 @@ cmd_find_current_client(struct cmd_q *cmdq)
|
||||
}
|
||||
|
||||
/* Maps string in table. */
|
||||
const char *
|
||||
static const char *
|
||||
cmd_find_map_table(const char *table[][2], const char *s)
|
||||
{
|
||||
u_int i;
|
||||
@@ -396,7 +398,7 @@ cmd_find_map_table(const char *table[][2], const char *s)
|
||||
}
|
||||
|
||||
/* Find session from string. Fills in s. */
|
||||
int
|
||||
static int
|
||||
cmd_find_get_session(struct cmd_find_state *fs, const char *session)
|
||||
{
|
||||
struct session *s, *s_loop;
|
||||
@@ -460,7 +462,7 @@ cmd_find_get_session(struct cmd_find_state *fs, const char *session)
|
||||
}
|
||||
|
||||
/* Find window from string. Fills in s, wl, w. */
|
||||
int
|
||||
static int
|
||||
cmd_find_get_window(struct cmd_find_state *fs, const char *window)
|
||||
{
|
||||
log_debug("%s: %s", __func__, window);
|
||||
@@ -496,7 +498,7 @@ cmd_find_get_window(struct cmd_find_state *fs, const char *window)
|
||||
* Find window from string, assuming it is in given session. Needs s, fills in
|
||||
* wl and w.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)
|
||||
{
|
||||
struct winlink *wl;
|
||||
@@ -646,18 +648,8 @@ cmd_find_get_window_with_session(struct cmd_find_state *fs, const char *window)
|
||||
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. */
|
||||
int
|
||||
static int
|
||||
cmd_find_get_pane(struct cmd_find_state *fs, const char *pane)
|
||||
{
|
||||
log_debug("%s: %s", __func__, pane);
|
||||
@@ -694,7 +686,7 @@ cmd_find_get_pane(struct cmd_find_state *fs, const char *pane)
|
||||
* Find pane from string, assuming it is in given session. Needs s, fills in wl
|
||||
* and w and wp.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane)
|
||||
{
|
||||
log_debug("%s: %s", __func__, pane);
|
||||
@@ -721,7 +713,7 @@ cmd_find_get_pane_with_session(struct cmd_find_state *fs, const char *pane)
|
||||
* Find pane from string, assuming it is in the given window. Needs w, fills in
|
||||
* wp.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
|
||||
{
|
||||
const char *errstr;
|
||||
|
Reference in New Issue
Block a user