diff options
author | 2019-05-12 08:58:09 +0000 | |
---|---|---|
committer | 2019-05-12 08:58:09 +0000 | |
commit | f43bc87ce21fa63ba7db125065b1cbe4929f403d (patch) | |
tree | 5a6006d67183ea243cc7cf8d2830b9bd79ef4393 /usr.bin/tmux/window-buffer.c | |
parent | new sentence, new line; (diff) | |
download | wireguard-openbsd-f43bc87ce21fa63ba7db125065b1cbe4929f403d.tar.xz wireguard-openbsd-f43bc87ce21fa63ba7db125065b1cbe4929f403d.zip |
Add simple menus to tree, client, buffer modes.
Diffstat (limited to 'usr.bin/tmux/window-buffer.c')
-rw-r--r-- | usr.bin/tmux/window-buffer.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-buffer.c b/usr.bin/tmux/window-buffer.c index 7d6438ddd02..63347f07b93 100644 --- a/usr.bin/tmux/window-buffer.c +++ b/usr.bin/tmux/window-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-buffer.c,v 1.18 2019/03/28 21:05:15 nicm Exp $ */ +/* $OpenBSD: window-buffer.c,v 1.19 2019/05/12 08:58:09 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -39,6 +39,19 @@ static void window_buffer_key(struct window_mode_entry *, #define WINDOW_BUFFER_DEFAULT_FORMAT \ "#{buffer_size} bytes (#{t:buffer_created})" +#define WINDOW_BUFFER_MENU \ + "Paste,p,|" \ + "Paste Tagged,P,|" \ + "|" \ + "Tag,t,|" \ + "Tag All,C-t,|" \ + "Tag None,T,|" \ + "|" \ + "Delete,d,|" \ + "Delete Tagged,D,|" \ + "|" \ + "Cancel,q," + const struct window_mode window_buffer_mode = { .name = "buffer-mode", .default_format = WINDOW_BUFFER_DEFAULT_FORMAT, @@ -67,7 +80,9 @@ struct window_buffer_itemdata { }; struct window_buffer_modedata { + struct window_pane *wp; struct cmd_find_state fs; + struct mode_tree_data *data; char *command; char *format; @@ -264,6 +279,19 @@ window_buffer_search(__unused void *modedata, void *itemdata, const char *ss) return (memmem(bufdata, bufsize, ss, strlen(ss)) != NULL); } +static void +window_buffer_menu(void *modedata, struct client *c, key_code key) +{ + struct window_buffer_modedata *data = modedata; + struct window_pane *wp = data->wp; + struct window_mode_entry *wme; + + wme = TAILQ_FIRST(&wp->modes); + if (wme == NULL || wme->data != modedata) + return; + window_buffer_key(wme, c, NULL, NULL, key, NULL); +} + static struct screen * window_buffer_init(struct window_mode_entry *wme, struct cmd_find_state *fs, struct args *args) @@ -273,6 +301,7 @@ window_buffer_init(struct window_mode_entry *wme, struct cmd_find_state *fs, struct screen *s; wme->data = data = xcalloc(1, sizeof *data); + data->wp = wp; cmd_find_copy_state(&data->fs, fs); if (args == NULL || !args_has(args, 'F')) @@ -285,8 +314,9 @@ window_buffer_init(struct window_mode_entry *wme, struct cmd_find_state *fs, data->command = xstrdup(args->argv[0]); data->data = mode_tree_start(wp, args, window_buffer_build, - window_buffer_draw, window_buffer_search, data, - window_buffer_sort_list, nitems(window_buffer_sort_list), &s); + window_buffer_draw, window_buffer_search, window_buffer_menu, data, + WINDOW_BUFFER_MENU, window_buffer_sort_list, + nitems(window_buffer_sort_list), &s); mode_tree_zoom(data->data, args); mode_tree_build(data->data); |