diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/Makefile | 15 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-command-prompt.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-select-prompt.c | 91 | ||||
-rw-r--r-- | usr.bin/tmux/cmd.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/key-bindings.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 10 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
7 files changed, 19 insertions, 113 deletions
diff --git a/usr.bin/tmux/Makefile b/usr.bin/tmux/Makefile index 5be404dd3af..e120bb45e38 100644 --- a/usr.bin/tmux/Makefile +++ b/usr.bin/tmux/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.40 2010/05/04 17:28:16 nicm Exp $ +# $OpenBSD: Makefile,v 1.41 2010/05/05 23:24:23 nicm Exp $ PROG= tmux SRCS= attributes.c cfg.c client.c clock.c \ @@ -19,16 +19,15 @@ SRCS= attributes.c cfg.c client.c clock.c \ cmd-previous-layout.c cmd-previous-window.c cmd-refresh-client.c \ cmd-rename-session.c cmd-rename-window.c cmd-resize-pane.c \ cmd-respawn-window.c cmd-rotate-window.c cmd-save-buffer.c \ - cmd-select-layout.c cmd-select-pane.c \ - cmd-select-prompt.c cmd-select-window.c cmd-send-keys.c \ - cmd-send-prefix.c cmd-server-info.c cmd-set-buffer.c cmd-set-option.c \ - cmd-set-window-option.c cmd-show-buffer.c cmd-show-messages.c \ - cmd-show-options.c cmd-show-window-options.c cmd-source-file.c \ - cmd-split-window.c cmd-start-server.c cmd-string.c cmd-if-shell.c \ + cmd-select-layout.c cmd-select-pane.c cmd-select-window.c \ + cmd-send-keys.c cmd-send-prefix.c cmd-server-info.c cmd-set-buffer.c \ + cmd-set-option.c cmd-set-window-option.c cmd-show-buffer.c \ + cmd-show-messages.c cmd-show-options.c cmd-show-window-options.c \ + cmd-source-file.c cmd-split-window.c cmd-start-server.c cmd-string.c \ cmd-run-shell.c cmd-suspend-client.c cmd-swap-pane.c cmd-swap-window.c \ cmd-switch-client.c cmd-unbind-key.c cmd-unlink-window.c \ cmd-set-environment.c cmd-show-environment.c cmd-choose-client.c \ - cmd-display-message.c cmd-display-panes.c \ + cmd-display-message.c cmd-display-panes.c cmd-if-shell.c \ cmd-pipe-pane.c cmd-capture-pane.c cmd.c \ colour.c environ.c grid-view.c grid-utf8.c grid.c input-keys.c \ imsg.c imsg-buffer.c input.c key-bindings.c key-string.c \ diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c index ca3aa567e27..50b0b6002ae 100644 --- a/usr.bin/tmux/cmd-command-prompt.c +++ b/usr.bin/tmux/cmd-command-prompt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-command-prompt.c,v 1.12 2009/11/13 19:53:29 nicm Exp $ */ +/* $OpenBSD: cmd-command-prompt.c,v 1.13 2010/05/05 23:24:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -81,6 +81,10 @@ cmd_command_prompt_init(struct cmd *self, int key) case 'f': data->template = xstrdup("find-window '%%'"); break; + case '\'': + data->template = xstrdup("select-window -t ':%%'"); + data->prompts = xstrdup("index"); + break; } } diff --git a/usr.bin/tmux/cmd-select-prompt.c b/usr.bin/tmux/cmd-select-prompt.c deleted file mode 100644 index 8e7ca113d91..00000000000 --- a/usr.bin/tmux/cmd-select-prompt.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $OpenBSD: cmd-select-prompt.c,v 1.7 2009/11/13 19:53:29 nicm Exp $ */ - -/* - * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/types.h> - -#include <stdlib.h> - -#include "tmux.h" - -/* - * Prompt for window index and select it. - */ - -int cmd_select_prompt_exec(struct cmd *, struct cmd_ctx *); - -int cmd_select_prompt_callback(void *, const char *); - -const struct cmd_entry cmd_select_prompt_entry = { - "select-prompt", NULL, - CMD_TARGET_CLIENT_USAGE, - 0, "", - cmd_target_init, - cmd_target_parse, - cmd_select_prompt_exec, - cmd_target_free, - cmd_target_print -}; - -int -cmd_select_prompt_exec(struct cmd *self, struct cmd_ctx *ctx) -{ - struct cmd_target_data *data = self->data; - struct client *c; - - if ((c = cmd_find_client(ctx, data->target)) == NULL) - return (-1); - - if (c->prompt_string != NULL) - return (0); - - status_prompt_set(c, "index ", cmd_select_prompt_callback, NULL, c, 0); - - return (0); -} - -int -cmd_select_prompt_callback(void *data, const char *s) -{ - struct client *c = data; - const char *errstr; - char msg[128]; - u_int idx; - - if (s == NULL || *s == '\0') - return (0); - - idx = strtonum(s, 0, UINT_MAX, &errstr); - if (errstr != NULL) { - xsnprintf(msg, sizeof msg, "Index %s: %s", errstr, s); - status_message_set(c, "%s", msg); - return (0); - } - - if (winlink_find_by_index(&c->session->windows, idx) == NULL) { - xsnprintf(msg, sizeof msg, - "Window not found: %s:%d", c->session->name, idx); - status_message_set(c, "%s", msg); - return (0); - } - - if (session_select(c->session, idx) == 0) - server_redraw_session(c->session); - recalculate_sizes(); - - return (0); -} diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c index e53fd6a546c..07b728a478a 100644 --- a/usr.bin/tmux/cmd.c +++ b/usr.bin/tmux/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.39 2010/03/22 19:07:52 nicm Exp $ */ +/* $OpenBSD: cmd.c,v 1.40 2010/05/05 23:24:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -85,7 +85,6 @@ const struct cmd_entry *cmd_table[] = { &cmd_save_buffer_entry, &cmd_select_layout_entry, &cmd_select_pane_entry, - &cmd_select_prompt_entry, &cmd_select_window_entry, &cmd_send_keys_entry, &cmd_send_prefix_entry, diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index 5e442a5db0c..3cba39ef519 100644 --- a/usr.bin/tmux/key-bindings.c +++ b/usr.bin/tmux/key-bindings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-bindings.c,v 1.20 2010/04/25 20:28:13 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.21 2010/05/05 23:24:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -125,7 +125,7 @@ key_bindings_init(void) { '?', 0, &cmd_list_keys_entry }, { 'D', 0, &cmd_choose_client_entry }, { '[', 0, &cmd_copy_mode_entry }, - { '\'', 0, &cmd_select_prompt_entry }, + { '\'', 0, &cmd_command_prompt_entry }, { '\002', /* C-b */ 0, &cmd_send_prefix_entry }, { '\017', /* C-o */ 0, &cmd_rotate_window_entry }, { '\032', /* C-z */ 0, &cmd_suspend_client_entry }, diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index c399f3a7038..e1d6f0ca2b3 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.166 2010/05/02 15:19:35 sobrado Exp $ +.\" $OpenBSD: tmux.1,v 1.167 2010/05/05 23:24:23 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 2 2010 $ +.Dd $Mdocdate: May 5 2010 $ .Dt TMUX 1 .Os .Sh NAME @@ -1265,7 +1265,7 @@ or keys, quotation marks are necessary, for example: .Bd -literal -offset indent bind-key '"' split-window -bind-key "'" select-prompt +bind-key "'" new-window .Ed .Pp Commands related to key bindings are as follows: @@ -2316,10 +2316,6 @@ The format of is as for .Ic status-left , with the exception that #() are not handled. -.It Ic select-prompt Op Fl t Ar target-client -Open a prompt inside -.Ar target-client -allowing a window index to be entered interactively. .El .Sh BUFFERS .Nm diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index b4cde87b6ea..0c98783b8ee 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.219 2010/05/04 17:28:16 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.220 2010/05/05 23:24:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1495,7 +1495,6 @@ extern const struct cmd_entry cmd_run_shell_entry; extern const struct cmd_entry cmd_save_buffer_entry; extern const struct cmd_entry cmd_select_layout_entry; extern const struct cmd_entry cmd_select_pane_entry; -extern const struct cmd_entry cmd_select_prompt_entry; extern const struct cmd_entry cmd_select_window_entry; extern const struct cmd_entry cmd_send_keys_entry; extern const struct cmd_entry cmd_send_prefix_entry; |