summaryrefslogtreecommitdiffstats
path: root/cmd-find.c
diff options
context:
space:
mode:
authornicm <nicm>2015-12-15 00:11:24 +0000
committernicm <nicm>2015-12-15 00:11:24 +0000
commit56d097cfe053f6cd50db9607503c25a80e3cd989 (patch)
tree044986d7d5c5687871c2194f3a4ba44fba18ac42 /cmd-find.c
parent12da13c9d1e0e015ed19761e352ee6b877b23aa4 (diff)
Don't copy marked pane when can just point to it.
Diffstat (limited to 'cmd-find.c')
-rw-r--r--cmd-find.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd-find.c b/cmd-find.c
index b7728ea2..ea1389a9 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -873,22 +873,23 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_q *cmdq,
log_debug("%s: target %s, type %d", __func__, target, type);
log_debug("%s: cmdq %p, flags %#x", __func__, cmdq, flags);
+ /* Clear new state. */
+ cmd_find_clear_state(fs, cmdq, flags);
+
/* Find current state. */
- cmd_find_clear_state(&current, cmdq, flags);
+ fs->current = NULL;
if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED))
- cmd_find_copy_state(&current, &marked_pane);
- else {
+ fs->current = &marked_pane;
+ if (fs->current == NULL) {
+ cmd_find_clear_state(&current, cmdq, flags);
if (cmd_find_current_session(&current) != 0) {
if (~flags & CMD_FIND_QUIET)
cmdq_error(cmdq, "no current session");
goto error;
}
+ fs->current = &current;
}
- /* Clear new state. */
- cmd_find_clear_state(fs, cmdq, flags);
- fs->current = &current;
-
/* An empty or NULL target is the current. */
if (target == NULL || *target == '\0')
goto current;
@@ -1087,9 +1088,9 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_q *cmdq,
current:
/* Use the current session. */
+ cmd_find_copy_state(fs, fs->current);
if (flags & CMD_FIND_WINDOW_INDEX)
- current.idx = -1;
- memcpy(fs, &current, sizeof *fs);
+ fs->idx = -1;
goto found;
error: