summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-tree.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-10-25 11:26:12 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-10-25 11:26:12 +0000
commita8f99b4c35cbc0cf12927ba434bdd8608ecc04bb (patch)
tree0e7ac866f9e43dcd4d3204b81a23e68edc1f1703 /usr.bin/tmux/window-tree.c
parent83f713bbf53343ede7efd313ddcbf2986e7771e7 (diff)
Add P key to paste tagged in buffer mode, and trim some code that should
no longer be necessary.
Diffstat (limited to 'usr.bin/tmux/window-tree.c')
-rw-r--r--usr.bin/tmux/window-tree.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c
index 443e4f241aa..bd6bbfe5006 100644
--- a/usr.bin/tmux/window-tree.c
+++ b/usr.bin/tmux/window-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-tree.c,v 1.20 2017/10/22 13:16:54 nicm Exp $ */
+/* $OpenBSD: window-tree.c,v 1.21 2017/10/25 11:26:11 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -95,7 +95,6 @@ struct window_tree_modedata {
struct window_tree_itemdata **item_list;
u_int item_size;
- struct client *client;
const char *entered;
struct cmd_find_state fs;
@@ -898,7 +897,8 @@ window_tree_get_target(struct window_tree_itemdata *item,
}
static void
-window_tree_command_each(void* modedata, void* itemdata, __unused key_code key)
+window_tree_command_each(void* modedata, void* itemdata, struct client *c,
+ __unused key_code key)
{
struct window_tree_modedata *data = modedata;
struct window_tree_itemdata *item = itemdata;
@@ -907,7 +907,7 @@ window_tree_command_each(void* modedata, void* itemdata, __unused key_code key)
name = window_tree_get_target(item, &fs);
if (name != NULL)
- mode_tree_run_command(data->client, &fs, data->entered, name);
+ mode_tree_run_command(c, &fs, data->entered, name);
free(name);
}
@@ -934,13 +934,9 @@ window_tree_command_callback(struct client *c, void *modedata, const char *s,
if (data->dead)
return (0);
- data->client = c;
data->entered = s;
-
- mode_tree_each_tagged(data->data, window_tree_command_each, KEYC_NONE,
- 1);
-
- data->client = NULL;
+ mode_tree_each_tagged(data->data, window_tree_command_each, c,
+ KEYC_NONE, 1);
data->entered = NULL;
data->references++;
@@ -963,7 +959,7 @@ window_tree_key(struct window_pane *wp, struct client *c,
{
struct window_tree_modedata *data = wp->modedata;
struct window_tree_itemdata *item;
- char *command, *name, *prompt;
+ char *name, *prompt;
struct cmd_find_state fs;
int finished;
u_int tagged;
@@ -992,14 +988,12 @@ window_tree_key(struct window_pane *wp, struct client *c,
break;
case '\r':
item = mode_tree_get_current(data->data);
- command = xstrdup(data->command);
name = window_tree_get_target(item, &fs);
- window_pane_reset_mode(wp);
if (name != NULL)
- mode_tree_run_command(c, NULL, command, name);
+ mode_tree_run_command(c, NULL, data->command, name);
+ finished = 1;
free(name);
- free(command);
- return;
+ break;
}
if (finished)
window_pane_reset_mode(wp);