mirror of
https://github.com/tmux/tmux.git
synced 2025-04-13 14:58:50 +00:00
Add cmd_find_from_winlink_pane and use it in a couple of places, and
make functions that can't fail void.
This commit is contained in:
parent
92a77e7654
commit
afa4e3ed9c
22
cmd-find.c
22
cmd-find.c
@ -879,7 +879,7 @@ cmd_find_log_state(const char *prefix, struct cmd_find_state *fs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Find state from a session. */
|
/* Find state from a session. */
|
||||||
int
|
void
|
||||||
cmd_find_from_session(struct cmd_find_state *fs, struct session *s)
|
cmd_find_from_session(struct cmd_find_state *fs, struct session *s)
|
||||||
{
|
{
|
||||||
cmd_find_clear_state(fs, NULL, 0);
|
cmd_find_clear_state(fs, NULL, 0);
|
||||||
@ -890,11 +890,10 @@ cmd_find_from_session(struct cmd_find_state *fs, struct session *s)
|
|||||||
fs->wp = fs->w->active;
|
fs->wp = fs->w->active;
|
||||||
|
|
||||||
cmd_find_log_state(__func__, fs);
|
cmd_find_log_state(__func__, fs);
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find state from a winlink. */
|
/* Find state from a winlink. */
|
||||||
int
|
void
|
||||||
cmd_find_from_winlink(struct cmd_find_state *fs, struct winlink *wl)
|
cmd_find_from_winlink(struct cmd_find_state *fs, struct winlink *wl)
|
||||||
{
|
{
|
||||||
cmd_find_clear_state(fs, NULL, 0);
|
cmd_find_clear_state(fs, NULL, 0);
|
||||||
@ -905,7 +904,6 @@ cmd_find_from_winlink(struct cmd_find_state *fs, struct winlink *wl)
|
|||||||
fs->wp = wl->window->active;
|
fs->wp = wl->window->active;
|
||||||
|
|
||||||
cmd_find_log_state(__func__, fs);
|
cmd_find_log_state(__func__, fs);
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find state from a session and window. */
|
/* Find state from a session and window. */
|
||||||
@ -942,6 +940,22 @@ cmd_find_from_window(struct cmd_find_state *fs, struct window *w)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find state from a winlink and pane. */
|
||||||
|
void
|
||||||
|
cmd_find_from_winlink_pane(struct cmd_find_state *fs, struct winlink *wl,
|
||||||
|
struct window_pane *wp)
|
||||||
|
{
|
||||||
|
cmd_find_clear_state(fs, NULL, 0);
|
||||||
|
|
||||||
|
fs->s = wl->session;
|
||||||
|
fs->wl = wl;
|
||||||
|
fs->idx = fs->wl->idx;
|
||||||
|
fs->w = fs->wl->window;
|
||||||
|
fs->wp = wp;
|
||||||
|
|
||||||
|
cmd_find_log_state(__func__, fs);
|
||||||
|
}
|
||||||
|
|
||||||
/* Find state from a pane. */
|
/* Find state from a pane. */
|
||||||
int
|
int
|
||||||
cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
|
cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
|
||||||
|
@ -172,12 +172,7 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
if (to_free != NULL)
|
if (to_free != NULL)
|
||||||
free((void *)to_free);
|
free((void *)to_free);
|
||||||
|
|
||||||
cmd_find_clear_state(&fs, NULL, 0);
|
cmd_find_from_winlink_pane(&fs, wl, new_wp);
|
||||||
fs.s = s;
|
|
||||||
fs.wl = wl;
|
|
||||||
fs.w = w;
|
|
||||||
fs.wp = new_wp;
|
|
||||||
cmd_find_log_state(__func__, &fs);
|
|
||||||
hooks_insert(s->hooks, item, &fs, "after-split-window");
|
hooks_insert(s->hooks, item, &fs, "after-split-window");
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
@ -946,11 +946,7 @@ retry:
|
|||||||
|
|
||||||
/* Find default state if the pane is known. */
|
/* Find default state if the pane is known. */
|
||||||
if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) {
|
if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) {
|
||||||
cmd_find_clear_state(&fs, NULL, 0);
|
cmd_find_from_winlink_pane(&fs, s->curw, wp);
|
||||||
fs.s = s;
|
|
||||||
fs.wl = fs.s->curw;
|
|
||||||
fs.w = fs.wl->window;
|
|
||||||
fs.wp = wp;
|
|
||||||
cmd_find_log_state(__func__, &fs);
|
cmd_find_log_state(__func__, &fs);
|
||||||
|
|
||||||
if (!cmd_find_valid_state(&fs))
|
if (!cmd_find_valid_state(&fs))
|
||||||
|
6
tmux.h
6
tmux.h
@ -1744,15 +1744,17 @@ int cmd_find_valid_state(struct cmd_find_state *);
|
|||||||
void cmd_find_copy_state(struct cmd_find_state *,
|
void cmd_find_copy_state(struct cmd_find_state *,
|
||||||
struct cmd_find_state *);
|
struct cmd_find_state *);
|
||||||
void cmd_find_log_state(const char *, struct cmd_find_state *);
|
void cmd_find_log_state(const char *, struct cmd_find_state *);
|
||||||
int cmd_find_from_session(struct cmd_find_state *,
|
void cmd_find_from_session(struct cmd_find_state *,
|
||||||
struct session *);
|
struct session *);
|
||||||
int cmd_find_from_winlink(struct cmd_find_state *,
|
void cmd_find_from_winlink(struct cmd_find_state *,
|
||||||
struct winlink *);
|
struct winlink *);
|
||||||
int cmd_find_from_session_window(struct cmd_find_state *,
|
int cmd_find_from_session_window(struct cmd_find_state *,
|
||||||
struct session *, struct window *);
|
struct session *, struct window *);
|
||||||
int cmd_find_from_window(struct cmd_find_state *, struct window *);
|
int cmd_find_from_window(struct cmd_find_state *, struct window *);
|
||||||
int cmd_find_from_pane(struct cmd_find_state *,
|
int cmd_find_from_pane(struct cmd_find_state *,
|
||||||
struct window_pane *);
|
struct window_pane *);
|
||||||
|
void cmd_find_from_winlink_pane(struct cmd_find_state *,
|
||||||
|
struct winlink *, struct window_pane *);
|
||||||
|
|
||||||
/* cmd.c */
|
/* cmd.c */
|
||||||
int cmd_pack_argv(int, char **, char *, size_t);
|
int cmd_pack_argv(int, char **, char *, size_t);
|
||||||
|
Loading…
Reference in New Issue
Block a user