mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-10 22:23:34 +02:00
Merge branch 'obsd-master'
This commit is contained in:
31
cmd-find.c
31
cmd-find.c
@ -1,7 +1,7 @@
|
||||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@ -922,15 +922,27 @@ cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Find current state. */
|
||||
int
|
||||
cmd_find_current(struct cmd_find_state *fs, struct cmd_q *cmdq, int flags)
|
||||
{
|
||||
cmd_find_clear_state(fs, cmdq, flags);
|
||||
if (cmd_find_current_session(fs) != 0) {
|
||||
if (~flags & CMD_FIND_QUIET)
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Split target into pieces and resolve for the given type. Fills in the given
|
||||
* state. Returns 0 on success or -1 on error.
|
||||
*/
|
||||
int
|
||||
cmd_find_target(struct cmd_find_state *fs, struct cmd_q *cmdq,
|
||||
const char *target, enum cmd_find_type type, int flags)
|
||||
cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
|
||||
struct cmd_q *cmdq, const char *target, enum cmd_find_type type, int flags)
|
||||
{
|
||||
struct cmd_find_state current;
|
||||
struct mouse_event *m;
|
||||
char *colon, *period, *copy = NULL;
|
||||
const char *session, *window, *pane;
|
||||
@ -950,15 +962,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_q *cmdq,
|
||||
fs->current = &marked_pane;
|
||||
else if (cmd_find_valid_state(&cmdq->current))
|
||||
fs->current = &cmdq->current;
|
||||
else {
|
||||
cmd_find_clear_state(¤t, cmdq, flags);
|
||||
if (cmd_find_current_session(¤t) != 0) {
|
||||
if (~flags & CMD_FIND_QUIET)
|
||||
cmdq_error(cmdq, "no current session");
|
||||
goto error;
|
||||
}
|
||||
fs->current = ¤t;
|
||||
}
|
||||
else
|
||||
fs->current = current;
|
||||
|
||||
/* An empty or NULL target is the current. */
|
||||
if (target == NULL || *target == '\0')
|
||||
|
Reference in New Issue
Block a user