From c103f2fbcbeb82019b694bed6869942bc1cbe966 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 20 Aug 2013 10:37:55 +0100 Subject: [PATCH 1/7] Clear window->flags when clearing winlinks When clearing WINLINK_ALERTFLAGS for all sessions, we must also, for that window, clear the window->flags as well, otherwise sessions may well still see flags for winlinks long since cleared. This therfore introduces WINDOW_ALERTFLAGS to help with this. --- tmux.h | 1 + window.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tmux.h b/tmux.h index 6ab9861b..0a17f72b 100644 --- a/tmux.h +++ b/tmux.h @@ -1005,6 +1005,7 @@ struct window { #define WINDOW_REDRAW 0x4 #define WINDOW_SILENCE 0x8 #define WINDOW_ZOOMED 0x10 +#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE) struct options options; diff --git a/window.c b/window.c index 7678adc6..7912bd37 100644 --- a/window.c +++ b/window.c @@ -1243,6 +1243,7 @@ winlink_clear_flags(struct winlink *wl) continue; wm->flags &= ~WINLINK_ALERTFLAGS; + wm->window->flags &= ~WINDOW_ALERTFLAGS; server_status_session(s); } } From a36da3a878a76f9570bee1b180a07243df4d382c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 21 Aug 2013 18:01:40 +0100 Subject: [PATCH 2/7] Remove the barely-used and unnecessary command check() function. --- cmd-attach-session.c | 1 - cmd-bind-key.c | 27 ++++++++++++--------------- cmd-break-pane.c | 1 - cmd-capture-pane.c | 1 - cmd-choose-buffer.c | 1 - cmd-choose-client.c | 1 - cmd-choose-list.c | 1 - cmd-choose-tree.c | 3 --- cmd-clear-history.c | 1 - cmd-clock-mode.c | 1 - cmd-command-prompt.c | 2 -- cmd-confirm-before.c | 1 - cmd-copy-mode.c | 1 - cmd-delete-buffer.c | 1 - cmd-detach-client.c | 1 - cmd-display-message.c | 1 - cmd-display-panes.c | 1 - cmd-find-window.c | 1 - cmd-has-session.c | 1 - cmd-if-shell.c | 1 - cmd-join-pane.c | 2 -- cmd-kill-pane.c | 1 - cmd-kill-server.c | 1 - cmd-kill-session.c | 1 - cmd-kill-window.c | 1 - cmd-link-window.c | 1 - cmd-list-buffers.c | 1 - cmd-list-clients.c | 1 - cmd-list-commands.c | 1 - cmd-list-keys.c | 1 - cmd-list-panes.c | 1 - cmd-list-sessions.c | 1 - cmd-list-windows.c | 1 - cmd-load-buffer.c | 1 - cmd-lock-server.c | 3 --- cmd-move-window.c | 1 - cmd-new-session.c | 15 +++++---------- cmd-new-window.c | 1 - cmd-paste-buffer.c | 1 - cmd-pipe-pane.c | 1 - cmd-refresh-client.c | 1 - cmd-rename-session.c | 1 - cmd-rename-window.c | 1 - cmd-resize-pane.c | 1 - cmd-respawn-pane.c | 1 - cmd-respawn-window.c | 1 - cmd-rotate-window.c | 1 - cmd-run-shell.c | 1 - cmd-save-buffer.c | 2 -- cmd-select-layout.c | 3 --- cmd-select-pane.c | 2 -- cmd-select-window.c | 4 ---- cmd-send-keys.c | 2 -- cmd-server-info.c | 1 - cmd-set-buffer.c | 1 - cmd-set-environment.c | 1 - cmd-set-option.c | 2 -- cmd-show-environment.c | 1 - cmd-show-messages.c | 1 - cmd-show-options.c | 2 -- cmd-source-file.c | 1 - cmd-split-window.c | 1 - cmd-start-server.c | 1 - cmd-suspend-client.c | 1 - cmd-swap-pane.c | 1 - cmd-swap-window.c | 1 - cmd-switch-client.c | 1 - cmd-unbind-key.c | 24 +++++++++++------------- cmd-unlink-window.c | 1 - cmd-wait-for.c | 1 - cmd.c | 2 -- tmux.h | 1 - 72 files changed, 28 insertions(+), 124 deletions(-) diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 07185737..cf5f30a4 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_attach_session_entry = { "[-dr] " CMD_TARGET_SESSION_USAGE, CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, NULL, - NULL, cmd_attach_session_exec }; diff --git a/cmd-bind-key.c b/cmd-bind-key.c index 71e79ea0..4ff3ac84 100644 --- a/cmd-bind-key.c +++ b/cmd-bind-key.c @@ -27,7 +27,6 @@ * Bind a key to a command, this recurses through cmd_*. */ -enum cmd_retval cmd_bind_key_check(struct args *); enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_bind_key_table(struct cmd *, struct cmd_q *, int); @@ -38,23 +37,9 @@ const struct cmd_entry cmd_bind_key_entry = { "[-cnr] [-t key-table] key command [arguments]", 0, NULL, - cmd_bind_key_check, cmd_bind_key_exec }; -enum cmd_retval -cmd_bind_key_check(struct args *args) -{ - if (args_has(args, 't')) { - if (args->argc != 2 && args->argc != 3) - return (CMD_RETURN_ERROR); - } else { - if (args->argc < 2) - return (CMD_RETURN_ERROR); - } - return (CMD_RETURN_NORMAL); -} - enum cmd_retval cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) { @@ -63,6 +48,18 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) struct cmd_list *cmdlist; int key; + if (args_has(args, 't')) { + if (args->argc != 2 && args->argc != 3) { + cmdq_error(cmdq, "not enough arguments"); + return (CMD_RETURN_ERROR); + } + } else { + if (args->argc < 2) { + cmdq_error(cmdq, "not enough arguments"); + return (CMD_RETURN_ERROR); + } + } + key = key_string_lookup_string(args->argv[0]); if (key == KEYC_NONE) { cmdq_error(cmdq, "unknown key: %s", args->argv[0]); diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 8ed9a1a6..d0a5a450 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_break_pane_entry = { "[-dP] [-F format] " CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_break_pane_exec }; diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index f59dc2d6..e157e3cb 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -42,7 +42,6 @@ const struct cmd_entry cmd_capture_pane_entry = { CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_capture_pane_exec }; diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index e6b79d91..d79f6fdc 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_choose_buffer_entry = { CMD_TARGET_WINDOW_USAGE " [-F format] [template]", 0, NULL, - NULL, cmd_choose_buffer_exec }; diff --git a/cmd-choose-client.c b/cmd-choose-client.c index 40752a70..93671987 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -37,7 +37,6 @@ const struct cmd_entry cmd_choose_client_entry = { CMD_TARGET_WINDOW_USAGE " [-F format] [template]", 0, NULL, - NULL, cmd_choose_client_exec }; diff --git a/cmd-choose-list.c b/cmd-choose-list.c index 15f87294..c3caabba 100644 --- a/cmd-choose-list.c +++ b/cmd-choose-list.c @@ -39,7 +39,6 @@ const struct cmd_entry cmd_choose_list_entry = { "[-l items] " CMD_TARGET_WINDOW_USAGE "[template]", 0, NULL, - NULL, cmd_choose_list_exec }; diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index a9b6ffbc..75ed5d2f 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -41,7 +41,6 @@ const struct cmd_entry cmd_choose_tree_entry = { "[-W format] " CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_choose_tree_exec }; @@ -51,7 +50,6 @@ const struct cmd_entry cmd_choose_session_entry = { CMD_TARGET_WINDOW_USAGE " [-F format] [template]", 0, NULL, - NULL, cmd_choose_tree_exec }; @@ -61,7 +59,6 @@ const struct cmd_entry cmd_choose_window_entry = { CMD_TARGET_WINDOW_USAGE "[-F format] [template]", 0, NULL, - NULL, cmd_choose_tree_exec }; diff --git a/cmd-clear-history.c b/cmd-clear-history.c index aebaa27d..cce3ea18 100644 --- a/cmd-clear-history.c +++ b/cmd-clear-history.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_clear_history_entry = { CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_clear_history_exec }; diff --git a/cmd-clock-mode.c b/cmd-clock-mode.c index 872f3d53..50e4ab8b 100644 --- a/cmd-clock-mode.c +++ b/cmd-clock-mode.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_clock_mode_entry = { CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_clock_mode_exec }; diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index 3bb79ed9..759d578b 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -30,7 +30,6 @@ */ void cmd_command_prompt_key_binding(struct cmd *, int); -int cmd_command_prompt_check(struct args *); enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); int cmd_command_prompt_callback(void *, const char *); @@ -42,7 +41,6 @@ const struct cmd_entry cmd_command_prompt_entry = { "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]", 0, cmd_command_prompt_key_binding, - NULL, cmd_command_prompt_exec }; diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index e670f69c..9266721f 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -38,7 +38,6 @@ const struct cmd_entry cmd_confirm_before_entry = { "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", 0, cmd_confirm_before_key_binding, - NULL, cmd_confirm_before_exec }; diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index 40584a28..f11c7aff 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -33,7 +33,6 @@ const struct cmd_entry cmd_copy_mode_entry = { "[-u] " CMD_TARGET_PANE_USAGE, 0, cmd_copy_mode_key_binding, - NULL, cmd_copy_mode_exec }; diff --git a/cmd-delete-buffer.c b/cmd-delete-buffer.c index bc3982ca..b8f55db4 100644 --- a/cmd-delete-buffer.c +++ b/cmd-delete-buffer.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_delete_buffer_entry = { CMD_BUFFER_USAGE, 0, NULL, - NULL, cmd_delete_buffer_exec }; diff --git a/cmd-detach-client.c b/cmd-detach-client.c index 6e00e079..ea9e3816 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_detach_client_entry = { "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, CMD_READONLY, NULL, - NULL, cmd_detach_client_exec }; diff --git a/cmd-display-message.c b/cmd-display-message.c index 485ccf08..006c49a5 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_display_message_entry = { " [message]", 0, NULL, - NULL, cmd_display_message_exec }; diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 4a8731a4..c137feef 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_display_panes_entry = { CMD_TARGET_CLIENT_USAGE, 0, NULL, - NULL, cmd_display_panes_exec }; diff --git a/cmd-find-window.c b/cmd-find-window.c index 02f19307..647cc8fb 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -48,7 +48,6 @@ const struct cmd_entry cmd_find_window_entry = { "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", 0, NULL, - NULL, cmd_find_window_exec }; diff --git a/cmd-has-session.c b/cmd-has-session.c index c4286b86..38a92f61 100644 --- a/cmd-has-session.c +++ b/cmd-has-session.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_has_session_entry = { CMD_TARGET_SESSION_USAGE, 0, NULL, - NULL, cmd_has_session_exec }; diff --git a/cmd-if-shell.c b/cmd-if-shell.c index d1cbd7f3..a074341b 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -41,7 +41,6 @@ const struct cmd_entry cmd_if_shell_entry = { "[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]", 0, NULL, - NULL, cmd_if_shell_exec }; diff --git a/cmd-join-pane.c b/cmd-join-pane.c index 2cf587e0..1a710cec 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -39,7 +39,6 @@ const struct cmd_entry cmd_join_pane_entry = { "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", 0, cmd_join_pane_key_binding, - NULL, cmd_join_pane_exec }; @@ -49,7 +48,6 @@ const struct cmd_entry cmd_move_pane_entry = { "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", 0, NULL, - NULL, cmd_join_pane_exec }; diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c index 40761350..bf486eb3 100644 --- a/cmd-kill-pane.c +++ b/cmd-kill-pane.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_kill_pane_entry = { "[-a] " CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_kill_pane_exec }; diff --git a/cmd-kill-server.c b/cmd-kill-server.c index a6065460..ba63faa3 100644 --- a/cmd-kill-server.c +++ b/cmd-kill-server.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_server_entry = { "", 0, NULL, - NULL, cmd_kill_server_exec }; diff --git a/cmd-kill-session.c b/cmd-kill-session.c index a12cc8a4..54b0c31b 100644 --- a/cmd-kill-session.c +++ b/cmd-kill-session.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_session_entry = { "[-a] " CMD_TARGET_SESSION_USAGE, 0, NULL, - NULL, cmd_kill_session_exec }; diff --git a/cmd-kill-window.c b/cmd-kill-window.c index 34b97499..ca8fe3d6 100644 --- a/cmd-kill-window.c +++ b/cmd-kill-window.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_kill_window_entry = { "[-a] " CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_kill_window_exec }; diff --git a/cmd-link-window.c b/cmd-link-window.c index 2be8ace0..d94eb38a 100644 --- a/cmd-link-window.c +++ b/cmd-link-window.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_link_window_entry = { "[-dk] " CMD_SRCDST_WINDOW_USAGE, 0, NULL, - NULL, cmd_link_window_exec }; diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index 58af0020..02a4183e 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_buffers_entry = { "[-F format]", 0, NULL, - NULL, cmd_list_buffers_exec }; diff --git a/cmd-list-clients.c b/cmd-list-clients.c index 59f63099..904ec005 100644 --- a/cmd-list-clients.c +++ b/cmd-list-clients.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_clients_entry = { "[-F format] " CMD_TARGET_SESSION_USAGE, CMD_READONLY, NULL, - NULL, cmd_list_clients_exec }; diff --git a/cmd-list-commands.c b/cmd-list-commands.c index 1bf6e703..06e48378 100644 --- a/cmd-list-commands.c +++ b/cmd-list-commands.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_list_commands_entry = { "", 0, NULL, - NULL, cmd_list_commands_exec }; diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 78998b66..615c5ce1 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_keys_entry = { "[-t key-table]", 0, NULL, - NULL, cmd_list_keys_exec }; diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 0d498e28..c989eba1 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -41,7 +41,6 @@ const struct cmd_entry cmd_list_panes_entry = { "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_list_panes_exec }; diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 61c12f4e..a3613c87 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_sessions_entry = { "[-F format]", 0, NULL, - NULL, cmd_list_sessions_exec }; diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 5c2a2b95..ce122f45 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -39,7 +39,6 @@ const struct cmd_entry cmd_list_windows_entry = { "[-a] [-F format] " CMD_TARGET_SESSION_USAGE, 0, NULL, - NULL, cmd_list_windows_exec }; diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index 3be14d6a..82b8f574 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -39,7 +39,6 @@ const struct cmd_entry cmd_load_buffer_entry = { CMD_BUFFER_USAGE " path", 0, NULL, - NULL, cmd_load_buffer_exec }; diff --git a/cmd-lock-server.c b/cmd-lock-server.c index 0b6aafe8..2b591ecf 100644 --- a/cmd-lock-server.c +++ b/cmd-lock-server.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_lock_server_entry = { "", 0, NULL, - NULL, cmd_lock_server_exec }; @@ -46,7 +45,6 @@ const struct cmd_entry cmd_lock_session_entry = { CMD_TARGET_SESSION_USAGE, 0, NULL, - NULL, cmd_lock_server_exec }; @@ -56,7 +54,6 @@ const struct cmd_entry cmd_lock_client_entry = { CMD_TARGET_CLIENT_USAGE, 0, NULL, - NULL, cmd_lock_server_exec }; diff --git a/cmd-move-window.c b/cmd-move-window.c index 1a147c7e..21606755 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_move_window_entry = { "[-dkr] " CMD_SRCDST_WINDOW_USAGE, 0, NULL, - NULL, cmd_move_window_exec }; diff --git a/cmd-new-session.c b/cmd-new-session.c index 4eebe632..b1e1aa45 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -30,7 +30,6 @@ * Create a new session and attach to the current terminal unless -d is given. */ -enum cmd_retval cmd_new_session_check(struct args *); enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_new_session_entry = { @@ -40,18 +39,9 @@ const struct cmd_entry cmd_new_session_entry = { CMD_TARGET_SESSION_USAGE " [-x width] [-y height] [command]", CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, NULL, - cmd_new_session_check, cmd_new_session_exec }; -enum cmd_retval -cmd_new_session_check(struct args *args) -{ - if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) - return (CMD_RETURN_ERROR); - return (CMD_RETURN_NORMAL); -} - enum cmd_retval cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) { @@ -70,6 +60,11 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) int already_attached; struct format_tree *ft; + if (args_has(args, 't') && (args->argc != 0 || args_has(args, 'n'))) { + cmdq_error(cmdq, "command or window name given with target"); + return (CMD_RETURN_ERROR); + } + newname = args_get(args, 's'); if (newname != NULL) { if (!session_check_name(newname)) { diff --git a/cmd-new-window.c b/cmd-new-window.c index cfc0b8bd..2ca0cecd 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_new_window_entry = { CMD_TARGET_WINDOW_USAGE " [command]", 0, NULL, - NULL, cmd_new_window_exec }; diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index b07c9faf..5305b7e6 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -38,7 +38,6 @@ const struct cmd_entry cmd_paste_buffer_entry = { "[-dpr] [-s separator] [-b buffer-index] " CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_paste_buffer_exec }; diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index aa72c699..611ad8cf 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -41,7 +41,6 @@ const struct cmd_entry cmd_pipe_pane_entry = { "[-o] " CMD_TARGET_PANE_USAGE " [command]", 0, NULL, - NULL, cmd_pipe_pane_exec }; diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c index 70e6888d..45804fbe 100644 --- a/cmd-refresh-client.c +++ b/cmd-refresh-client.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_refresh_client_entry = { "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, 0, NULL, - NULL, cmd_refresh_client_exec }; diff --git a/cmd-rename-session.c b/cmd-rename-session.c index 3f8a9d8f..4c8ae122 100644 --- a/cmd-rename-session.c +++ b/cmd-rename-session.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_session_entry = { CMD_TARGET_SESSION_USAGE " new-name", 0, NULL, - NULL, cmd_rename_session_exec }; diff --git a/cmd-rename-window.c b/cmd-rename-window.c index c756ba1f..f647abb3 100644 --- a/cmd-rename-window.c +++ b/cmd-rename-window.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_window_entry = { CMD_TARGET_WINDOW_USAGE " new-name", 0, NULL, - NULL, cmd_rename_window_exec }; diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index ca2a6cd3..d31f8868 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_resize_pane_entry = { "[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", 0, cmd_resize_pane_key_binding, - NULL, cmd_resize_pane_exec }; diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c index 4486c91f..36f8783b 100644 --- a/cmd-respawn-pane.c +++ b/cmd-respawn-pane.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_respawn_pane_entry = { "[-k] " CMD_TARGET_PANE_USAGE " [command]", 0, NULL, - NULL, cmd_respawn_pane_exec }; diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c index 35bd3471..6026ca64 100644 --- a/cmd-respawn-window.c +++ b/cmd-respawn-window.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_respawn_window_entry = { "[-k] " CMD_TARGET_WINDOW_USAGE " [command]", 0, NULL, - NULL, cmd_respawn_window_exec }; diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c index 75ca7292..9f4cc751 100644 --- a/cmd-rotate-window.c +++ b/cmd-rotate-window.c @@ -33,7 +33,6 @@ const struct cmd_entry cmd_rotate_window_entry = { "[-DU] " CMD_TARGET_WINDOW_USAGE, 0, cmd_rotate_window_key_binding, - NULL, cmd_rotate_window_exec }; diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 7c7d333c..f5231814 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -41,7 +41,6 @@ const struct cmd_entry cmd_run_shell_entry = { "[-b] " CMD_TARGET_PANE_USAGE " shell-command", 0, NULL, - NULL, cmd_run_shell_exec }; diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c index 52914a94..c6c54019 100644 --- a/cmd-save-buffer.c +++ b/cmd-save-buffer.c @@ -37,7 +37,6 @@ const struct cmd_entry cmd_save_buffer_entry = { "[-a] " CMD_BUFFER_USAGE " path", 0, NULL, - NULL, cmd_save_buffer_exec }; @@ -47,7 +46,6 @@ const struct cmd_entry cmd_show_buffer_entry = { CMD_BUFFER_USAGE, 0, NULL, - NULL, cmd_save_buffer_exec }; diff --git a/cmd-select-layout.c b/cmd-select-layout.c index ae1be4c4..053f3e40 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_layout_entry = { "[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]", 0, cmd_select_layout_key_binding, - NULL, cmd_select_layout_exec }; @@ -43,7 +42,6 @@ const struct cmd_entry cmd_next_layout_entry = { CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_select_layout_exec }; @@ -53,7 +51,6 @@ const struct cmd_entry cmd_previous_layout_entry = { CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_select_layout_exec }; diff --git a/cmd-select-pane.c b/cmd-select-pane.c index b8a12671..c342fef3 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_pane_entry = { "[-lDLRU] " CMD_TARGET_PANE_USAGE, 0, cmd_select_pane_key_binding, - NULL, cmd_select_pane_exec }; @@ -43,7 +42,6 @@ const struct cmd_entry cmd_last_pane_entry = { CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_select_pane_exec }; diff --git a/cmd-select-window.c b/cmd-select-window.c index c15d5858..73196200 100644 --- a/cmd-select-window.c +++ b/cmd-select-window.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_select_window_entry = { "[-lnpT] " CMD_TARGET_WINDOW_USAGE, 0, cmd_select_window_key_binding, - NULL, cmd_select_window_exec }; @@ -45,7 +44,6 @@ const struct cmd_entry cmd_next_window_entry = { "[-a] " CMD_TARGET_SESSION_USAGE, 0, cmd_select_window_key_binding, - NULL, cmd_select_window_exec }; @@ -55,7 +53,6 @@ const struct cmd_entry cmd_previous_window_entry = { "[-a] " CMD_TARGET_SESSION_USAGE, 0, cmd_select_window_key_binding, - NULL, cmd_select_window_exec }; @@ -65,7 +62,6 @@ const struct cmd_entry cmd_last_window_entry = { CMD_TARGET_SESSION_USAGE, 0, NULL, - NULL, cmd_select_window_exec }; diff --git a/cmd-send-keys.c b/cmd-send-keys.c index a2041656..50cb70e2 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_send_keys_entry = { "[-lR] " CMD_TARGET_PANE_USAGE " key ...", 0, NULL, - NULL, cmd_send_keys_exec }; @@ -45,7 +44,6 @@ const struct cmd_entry cmd_send_prefix_entry = { "[-2] " CMD_TARGET_PANE_USAGE, 0, NULL, - NULL, cmd_send_keys_exec }; diff --git a/cmd-server-info.c b/cmd-server-info.c index 8eba172a..3aa5df8a 100644 --- a/cmd-server-info.c +++ b/cmd-server-info.c @@ -38,7 +38,6 @@ const struct cmd_entry cmd_server_info_entry = { "", 0, NULL, - NULL, cmd_server_info_exec }; diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index 46d28ff2..fade4fe3 100644 --- a/cmd-set-buffer.c +++ b/cmd-set-buffer.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_buffer_entry = { CMD_BUFFER_USAGE " data", 0, NULL, - NULL, cmd_set_buffer_exec }; diff --git a/cmd-set-environment.c b/cmd-set-environment.c index 0f0365aa..8d067c35 100644 --- a/cmd-set-environment.c +++ b/cmd-set-environment.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_environment_entry = { "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", 0, NULL, - NULL, cmd_set_environment_exec }; diff --git a/cmd-set-option.c b/cmd-set-option.c index c246743c..3acf125d 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -67,7 +67,6 @@ const struct cmd_entry cmd_set_option_entry = { "[-agosquw] [-t target-session|target-window] option [value]", 0, NULL, - NULL, cmd_set_option_exec }; @@ -77,7 +76,6 @@ const struct cmd_entry cmd_set_window_option_entry = { "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", 0, NULL, - NULL, cmd_set_option_exec }; diff --git a/cmd-show-environment.c b/cmd-show-environment.c index ffe98bcc..2238929e 100644 --- a/cmd-show-environment.c +++ b/cmd-show-environment.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_environment_entry = { "[-g] " CMD_TARGET_SESSION_USAGE " [name]", 0, NULL, - NULL, cmd_show_environment_exec }; diff --git a/cmd-show-messages.c b/cmd-show-messages.c index bc2424ad..256570cd 100644 --- a/cmd-show-messages.c +++ b/cmd-show-messages.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_messages_entry = { CMD_TARGET_CLIENT_USAGE, 0, NULL, - NULL, cmd_show_messages_exec }; diff --git a/cmd-show-options.c b/cmd-show-options.c index e2f78e12..943353f6 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -40,7 +40,6 @@ const struct cmd_entry cmd_show_options_entry = { "[-gqsvw] [-t target-session|target-window] [option]", 0, NULL, - NULL, cmd_show_options_exec }; @@ -50,7 +49,6 @@ const struct cmd_entry cmd_show_window_options_entry = { "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", 0, NULL, - NULL, cmd_show_options_exec }; diff --git a/cmd-source-file.c b/cmd-source-file.c index 45a3a39b..d636643d 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -37,7 +37,6 @@ const struct cmd_entry cmd_source_file_entry = { "path", 0, NULL, - NULL, cmd_source_file_exec }; diff --git a/cmd-split-window.c b/cmd-split-window.c index 601dcb17..5b5140be 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_split_window_entry = { "[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]", 0, - cmd_split_window_key_binding, NULL, cmd_split_window_exec }; diff --git a/cmd-start-server.c b/cmd-start-server.c index cba2403b..33b28b4a 100644 --- a/cmd-start-server.c +++ b/cmd-start-server.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_start_server_entry = { "", CMD_STARTSERVER, NULL, - NULL, cmd_start_server_exec }; diff --git a/cmd-suspend-client.c b/cmd-suspend-client.c index 101658b1..e0e375fc 100644 --- a/cmd-suspend-client.c +++ b/cmd-suspend-client.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_suspend_client_entry = { CMD_TARGET_CLIENT_USAGE, 0, NULL, - NULL, cmd_suspend_client_exec }; diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index 05317260..b8ff7690 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -35,7 +35,6 @@ const struct cmd_entry cmd_swap_pane_entry = { "[-dDU] " CMD_SRCDST_PANE_USAGE, 0, cmd_swap_pane_key_binding, - NULL, cmd_swap_pane_exec }; diff --git a/cmd-swap-window.c b/cmd-swap-window.c index f9a2cb1b..1591d403 100644 --- a/cmd-swap-window.c +++ b/cmd-swap-window.c @@ -34,7 +34,6 @@ const struct cmd_entry cmd_swap_window_entry = { "[-d] " CMD_SRCDST_WINDOW_USAGE, 0, NULL, - NULL, cmd_swap_window_exec }; diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 9adb2146..d101c52b 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_switch_client_entry = { "[-lnpr] [-c target-client] [-t target-session]", CMD_READONLY, cmd_switch_client_key_binding, - NULL, cmd_switch_client_exec }; diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c index dc037dde..9bd068e1 100644 --- a/cmd-unbind-key.c +++ b/cmd-unbind-key.c @@ -26,7 +26,6 @@ * Unbind key from command. */ -enum cmd_retval cmd_unbind_key_check(struct args *); enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_unbind_key_table(struct cmd *, struct cmd_q *, int); @@ -36,20 +35,9 @@ const struct cmd_entry cmd_unbind_key_entry = { "[-acn] [-t key-table] key", 0, NULL, - cmd_unbind_key_check, cmd_unbind_key_exec }; -enum cmd_retval -cmd_unbind_key_check(struct args *args) -{ - if (args_has(args, 'a') && args->argc != 0) - return (CMD_RETURN_ERROR); - if (!args_has(args, 'a') && args->argc != 1) - return (CMD_RETURN_ERROR); - return (CMD_RETURN_NORMAL); -} - enum cmd_retval cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) { @@ -58,13 +46,23 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) int key; if (!args_has(args, 'a')) { + if (args->argc != 1) { + cmdq_error(cmdq, "missing key"); + return (CMD_RETURN_ERROR); + } + return (CMD_RETURN_ERROR); key = key_string_lookup_string(args->argv[0]); if (key == KEYC_NONE) { cmdq_error(cmdq, "unknown key: %s", args->argv[0]); return (CMD_RETURN_ERROR); } - } else + } else { + if (args->argc != 0) { + cmdq_error(cmdq, "key given with -a"); + return (CMD_RETURN_ERROR); + } key = KEYC_NONE; + } if (args_has(args, 't')) return (cmd_unbind_key_table(self, cmdq, key)); diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c index 39cdd8ed..ec69b91f 100644 --- a/cmd-unlink-window.c +++ b/cmd-unlink-window.c @@ -32,7 +32,6 @@ const struct cmd_entry cmd_unlink_window_entry = { "[-k] " CMD_TARGET_WINDOW_USAGE, 0, NULL, - NULL, cmd_unlink_window_exec }; diff --git a/cmd-wait-for.c b/cmd-wait-for.c index d40ba49e..e87e197a 100644 --- a/cmd-wait-for.c +++ b/cmd-wait-for.c @@ -36,7 +36,6 @@ const struct cmd_entry cmd_wait_for_entry = { "[-LSU] channel", 0, NULL, - NULL, cmd_wait_for_exec }; diff --git a/cmd.c b/cmd.c index 282fb112..c9eb41a1 100644 --- a/cmd.c +++ b/cmd.c @@ -254,8 +254,6 @@ cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause) goto usage; if (entry->args_upper != -1 && args->argc > entry->args_upper) goto usage; - if (entry->check != NULL && entry->check(args) != 0) - goto usage; cmd = xcalloc(1, sizeof *cmd); cmd->entry = entry; diff --git a/tmux.h b/tmux.h index 6ab9861b..5b2aac5b 100644 --- a/tmux.h +++ b/tmux.h @@ -1451,7 +1451,6 @@ struct cmd_entry { int flags; void (*key_binding)(struct cmd *, int); - int (*check)(struct args *); enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); }; From 8954d01f968d73f5e60bdff200b7549b09d511c3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 21 Aug 2013 18:28:31 +0100 Subject: [PATCH 3/7] + to TODO. --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index e72e83a2..ea672fa4 100644 --- a/TODO +++ b/TODO @@ -30,6 +30,7 @@ * choose-mode and copy-mode are very similar, make choose-mode a subset? * flag to choose-* for sort order * choose mode would be better per client than per window + * two choices (first one then second, for swap-pane and join-pane) - improve monitor-*: * straighten out rules for multiple clients From 25c0dc5e6ed467f99aeb63f628f9d185a39e6d3b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 21 Aug 2013 18:30:27 +0100 Subject: [PATCH 4/7] ++ to TODO. --- TODO | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO b/TODO index ea672fa4..c623c8b5 100644 --- a/TODO +++ b/TODO @@ -18,6 +18,8 @@ - options bits and pieces: * set-remain-on-exit is a complete hack * way to set socket path from config file + * -fg/-bg/-attr is crap - better just foo-style options which accept + fg=,bg=,bright and so on like #[] - format improvements: * option to quote format (#{session_name:quoted}) From e3864c383f2678b0391a897cdccab7ad3bb98232 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 21 Aug 2013 18:33:34 +0100 Subject: [PATCH 5/7] Remove from TODO. --- TODO | 2 -- 1 file changed, 2 deletions(-) diff --git a/TODO b/TODO index c623c8b5..f4cf7b6d 100644 --- a/TODO +++ b/TODO @@ -94,8 +94,6 @@ - mouse-select-pane will screw up with !MODE_MOUSE_STANDARD (it sets the flag on w/o checking the others before calling tty_update_mode) -- panes should have names like windows - - way to tag a layout as a number/name - optimize pane redraws, 20120318184853.GK10965@yelena.nicm.ath.cx From f2675cdf04f9b01d86ce98df620c91393fbb8db4 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 21 Aug 2013 18:35:01 +0100 Subject: [PATCH 6/7] Trivial style and spacing nits. --- cmd-display-message.c | 6 +++--- grid.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd-display-message.c b/cmd-display-message.c index 006c49a5..78752f86 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -70,9 +70,9 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq) } if (args_has(args, 'c')) { - c = cmd_find_client(cmdq, args_get(args, 'c'), 0); - if (c == NULL) - return (CMD_RETURN_ERROR); + c = cmd_find_client(cmdq, args_get(args, 'c'), 0); + if (c == NULL) + return (CMD_RETURN_ERROR); } else { c = cmd_current_client(cmdq); if (c == NULL && !args_has(self->args, 'p')) { diff --git a/grid.c b/grid.c index 5cc6c149..9e800243 100644 --- a/grid.c +++ b/grid.c @@ -268,8 +268,7 @@ grid_get_cell(struct grid *gd, u_int px, u_int py) /* Set cell at relative position. */ void -grid_set_cell( - struct grid *gd, u_int px, u_int py, const struct grid_cell *gc) +grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc) { if (grid_check_y(gd, py) != 0) return; @@ -657,8 +656,8 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx, * available. */ void -grid_duplicate_lines( - struct grid *dst, u_int dy, struct grid *src, u_int sy, u_int ny) +grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy, + u_int ny) { struct grid_line *dstl, *srcl; u_int yy; From a0802dd4869bfefe548734a840dc2e1d3cb15c90 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 22 Aug 2013 00:32:55 +0100 Subject: [PATCH 7/7] A couple of manpage fixes from Tiago Cunha. --- tmux.1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tmux.1 b/tmux.1 index c93f4d97..ede1bb20 100644 --- a/tmux.1 +++ b/tmux.1 @@ -99,7 +99,9 @@ Force .Nm to assume the terminal supports 256 colours. .It Fl C -Start in control mode. +Start in control mode (see the +.Sx CONTROL MODE +section). Given twice .Xo ( Fl CC ) Xc disables echo. @@ -626,9 +628,10 @@ If it does exist, exit with 0. Kill the .Nm server and clients and destroy all sessions. -.It Ic kill-session +.It Xo Ic kill-session .Op Fl a .Op Fl t Ar target-session +.Xc Destroy the given session, closing any windows linked to it and no other sessions, and detaching all clients attached to it. If