Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code

This commit is contained in:
Nicholas Marriott 2013-08-23 15:58:46 +01:00
commit 2f7ffab0e8
76 changed files with 44 additions and 135 deletions

5
TODO
View File

@ -18,6 +18,8 @@
- options bits and pieces: - options bits and pieces:
* set-remain-on-exit is a complete hack * set-remain-on-exit is a complete hack
* way to set socket path from config file * 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: - format improvements:
* option to quote format (#{session_name:quoted}) * option to quote format (#{session_name:quoted})
@ -30,6 +32,7 @@
* choose-mode and copy-mode are very similar, make choose-mode a subset? * choose-mode and copy-mode are very similar, make choose-mode a subset?
* flag to choose-* for sort order * flag to choose-* for sort order
* choose mode would be better per client than per window * choose mode would be better per client than per window
* two choices (first one then second, for swap-pane and join-pane)
- improve monitor-*: - improve monitor-*:
* straighten out rules for multiple clients * straighten out rules for multiple clients
@ -91,8 +94,6 @@
- mouse-select-pane will screw up with !MODE_MOUSE_STANDARD (it sets the flag - 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) 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 - way to tag a layout as a number/name
- optimize pane redraws, 20120318184853.GK10965@yelena.nicm.ath.cx - optimize pane redraws, 20120318184853.GK10965@yelena.nicm.ath.cx

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_attach_session_entry = {
"[-dr] " CMD_TARGET_SESSION_USAGE, "[-dr] " CMD_TARGET_SESSION_USAGE,
CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON, CMD_CANTNEST|CMD_STARTSERVER|CMD_SENDENVIRON,
NULL, NULL,
NULL,
cmd_attach_session_exec cmd_attach_session_exec
}; };

View File

@ -27,7 +27,6 @@
* Bind a key to a command, this recurses through cmd_*. * 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_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_bind_key_table(struct cmd *, struct cmd_q *, int); 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]", "[-cnr] [-t key-table] key command [arguments]",
0, 0,
NULL, NULL,
cmd_bind_key_check,
cmd_bind_key_exec 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 enum cmd_retval
cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) 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; struct cmd_list *cmdlist;
int key; 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]); key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE) { if (key == KEYC_NONE) {
cmdq_error(cmdq, "unknown key: %s", args->argv[0]); cmdq_error(cmdq, "unknown key: %s", args->argv[0]);

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_break_pane_entry = {
"[-dP] [-F format] " CMD_TARGET_PANE_USAGE, "[-dP] [-F format] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_break_pane_exec cmd_break_pane_exec
}; };

View File

@ -42,7 +42,6 @@ const struct cmd_entry cmd_capture_pane_entry = {
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_capture_pane_exec cmd_capture_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_choose_buffer_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]", CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_buffer_exec cmd_choose_buffer_exec
}; };

View File

@ -37,7 +37,6 @@ const struct cmd_entry cmd_choose_client_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]", CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_client_exec cmd_choose_client_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_choose_list_entry = {
"[-l items] " CMD_TARGET_WINDOW_USAGE "[template]", "[-l items] " CMD_TARGET_WINDOW_USAGE "[template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_list_exec cmd_choose_list_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_choose_tree_entry = {
"[-W format] " CMD_TARGET_WINDOW_USAGE, "[-W format] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_choose_tree_exec cmd_choose_tree_exec
}; };
@ -51,7 +50,6 @@ const struct cmd_entry cmd_choose_session_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]", CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_tree_exec cmd_choose_tree_exec
}; };
@ -61,7 +59,6 @@ const struct cmd_entry cmd_choose_window_entry = {
CMD_TARGET_WINDOW_USAGE "[-F format] [template]", CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_tree_exec cmd_choose_tree_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_clear_history_entry = {
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_clear_history_exec cmd_clear_history_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_clock_mode_entry = {
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_clock_mode_exec cmd_clock_mode_exec
}; };

View File

@ -30,7 +30,6 @@
*/ */
void cmd_command_prompt_key_binding(struct cmd *, int); 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 *); enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *);
int cmd_command_prompt_callback(void *, const char *); 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]", "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]",
0, 0,
cmd_command_prompt_key_binding, cmd_command_prompt_key_binding,
NULL,
cmd_command_prompt_exec cmd_command_prompt_exec
}; };

View File

@ -38,7 +38,6 @@ const struct cmd_entry cmd_confirm_before_entry = {
"[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
0, 0,
cmd_confirm_before_key_binding, cmd_confirm_before_key_binding,
NULL,
cmd_confirm_before_exec cmd_confirm_before_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_copy_mode_entry = {
"[-u] " CMD_TARGET_PANE_USAGE, "[-u] " CMD_TARGET_PANE_USAGE,
0, 0,
cmd_copy_mode_key_binding, cmd_copy_mode_key_binding,
NULL,
cmd_copy_mode_exec cmd_copy_mode_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_delete_buffer_entry = {
CMD_BUFFER_USAGE, CMD_BUFFER_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_delete_buffer_exec cmd_delete_buffer_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_detach_client_entry = {
"[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE,
CMD_READONLY, CMD_READONLY,
NULL, NULL,
NULL,
cmd_detach_client_exec cmd_detach_client_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_display_message_entry = {
" [message]", " [message]",
0, 0,
NULL, NULL,
NULL,
cmd_display_message_exec cmd_display_message_exec
}; };
@ -71,9 +70,9 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
} }
if (args_has(args, 'c')) { if (args_has(args, 'c')) {
c = cmd_find_client(cmdq, args_get(args, 'c'), 0); c = cmd_find_client(cmdq, args_get(args, 'c'), 0);
if (c == NULL) if (c == NULL)
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} else { } else {
c = cmd_current_client(cmdq); c = cmd_current_client(cmdq);
if (c == NULL && !args_has(self->args, 'p')) { if (c == NULL && !args_has(self->args, 'p')) {

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_display_panes_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_display_panes_exec cmd_display_panes_exec
}; };

View File

@ -48,7 +48,6 @@ const struct cmd_entry cmd_find_window_entry = {
"[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
0, 0,
NULL, NULL,
NULL,
cmd_find_window_exec cmd_find_window_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_has_session_entry = {
CMD_TARGET_SESSION_USAGE, CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_has_session_exec cmd_has_session_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_if_shell_entry = {
"[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]", "[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]",
0, 0,
NULL, NULL,
NULL,
cmd_if_shell_exec cmd_if_shell_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_join_pane_entry = {
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
0, 0,
cmd_join_pane_key_binding, cmd_join_pane_key_binding,
NULL,
cmd_join_pane_exec 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]", "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
0, 0,
NULL, NULL,
NULL,
cmd_join_pane_exec cmd_join_pane_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_kill_pane_entry = {
"[-a] " CMD_TARGET_PANE_USAGE, "[-a] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_kill_pane_exec cmd_kill_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_server_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_kill_server_exec cmd_kill_server_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_session_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE, "[-a] " CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_kill_session_exec cmd_kill_session_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_kill_window_entry = {
"[-a] " CMD_TARGET_WINDOW_USAGE, "[-a] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_kill_window_exec cmd_kill_window_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_link_window_entry = {
"[-dk] " CMD_SRCDST_WINDOW_USAGE, "[-dk] " CMD_SRCDST_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_link_window_exec cmd_link_window_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_buffers_entry = {
"[-F format]", "[-F format]",
0, 0,
NULL, NULL,
NULL,
cmd_list_buffers_exec cmd_list_buffers_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_clients_entry = {
"[-F format] " CMD_TARGET_SESSION_USAGE, "[-F format] " CMD_TARGET_SESSION_USAGE,
CMD_READONLY, CMD_READONLY,
NULL, NULL,
NULL,
cmd_list_clients_exec cmd_list_clients_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_list_commands_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_list_commands_exec cmd_list_commands_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_keys_entry = {
"[-t key-table]", "[-t key-table]",
0, 0,
NULL, NULL,
NULL,
cmd_list_keys_exec cmd_list_keys_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_list_panes_entry = {
"[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_list_panes_exec cmd_list_panes_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_sessions_entry = {
"[-F format]", "[-F format]",
0, 0,
NULL, NULL,
NULL,
cmd_list_sessions_exec cmd_list_sessions_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_list_windows_entry = {
"[-a] [-F format] " CMD_TARGET_SESSION_USAGE, "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_list_windows_exec cmd_list_windows_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_load_buffer_entry = {
CMD_BUFFER_USAGE " path", CMD_BUFFER_USAGE " path",
0, 0,
NULL, NULL,
NULL,
cmd_load_buffer_exec cmd_load_buffer_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_lock_server_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_lock_server_exec cmd_lock_server_exec
}; };
@ -46,7 +45,6 @@ const struct cmd_entry cmd_lock_session_entry = {
CMD_TARGET_SESSION_USAGE, CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_lock_server_exec cmd_lock_server_exec
}; };
@ -56,7 +54,6 @@ const struct cmd_entry cmd_lock_client_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_lock_server_exec cmd_lock_server_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_move_window_entry = {
"[-dkr] " CMD_SRCDST_WINDOW_USAGE, "[-dkr] " CMD_SRCDST_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_move_window_exec cmd_move_window_exec
}; };

View File

@ -30,7 +30,6 @@
* Create a new session and attach to the current terminal unless -d is given. * 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 *); enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_session_entry = { 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_TARGET_SESSION_USAGE " [-x width] [-y height] [command]",
CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON, CMD_STARTSERVER|CMD_CANTNEST|CMD_SENDENVIRON,
NULL, NULL,
cmd_new_session_check,
cmd_new_session_exec 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 enum cmd_retval
cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) 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; int already_attached;
struct format_tree *ft; 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'); newname = args_get(args, 's');
if (newname != NULL) { if (newname != NULL) {
if (!session_check_name(newname)) { if (!session_check_name(newname)) {

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_new_window_entry = {
CMD_TARGET_WINDOW_USAGE " [command]", CMD_TARGET_WINDOW_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_new_window_exec cmd_new_window_exec
}; };

View File

@ -38,7 +38,6 @@ const struct cmd_entry cmd_paste_buffer_entry = {
"[-dpr] [-s separator] [-b buffer-index] " CMD_TARGET_PANE_USAGE, "[-dpr] [-s separator] [-b buffer-index] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_paste_buffer_exec cmd_paste_buffer_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_pipe_pane_entry = {
"[-o] " CMD_TARGET_PANE_USAGE " [command]", "[-o] " CMD_TARGET_PANE_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_pipe_pane_exec cmd_pipe_pane_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_refresh_client_entry = {
"[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_refresh_client_exec cmd_refresh_client_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_session_entry = {
CMD_TARGET_SESSION_USAGE " new-name", CMD_TARGET_SESSION_USAGE " new-name",
0, 0,
NULL, NULL,
NULL,
cmd_rename_session_exec cmd_rename_session_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_window_entry = {
CMD_TARGET_WINDOW_USAGE " new-name", CMD_TARGET_WINDOW_USAGE " new-name",
0, 0,
NULL, NULL,
NULL,
cmd_rename_window_exec cmd_rename_window_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_resize_pane_entry = {
"[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", "[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]",
0, 0,
cmd_resize_pane_key_binding, cmd_resize_pane_key_binding,
NULL,
cmd_resize_pane_exec cmd_resize_pane_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_respawn_pane_entry = {
"[-k] " CMD_TARGET_PANE_USAGE " [command]", "[-k] " CMD_TARGET_PANE_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_respawn_pane_exec cmd_respawn_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_respawn_window_entry = {
"[-k] " CMD_TARGET_WINDOW_USAGE " [command]", "[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_respawn_window_exec cmd_respawn_window_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_rotate_window_entry = {
"[-DU] " CMD_TARGET_WINDOW_USAGE, "[-DU] " CMD_TARGET_WINDOW_USAGE,
0, 0,
cmd_rotate_window_key_binding, cmd_rotate_window_key_binding,
NULL,
cmd_rotate_window_exec cmd_rotate_window_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_run_shell_entry = {
"[-b] " CMD_TARGET_PANE_USAGE " shell-command", "[-b] " CMD_TARGET_PANE_USAGE " shell-command",
0, 0,
NULL, NULL,
NULL,
cmd_run_shell_exec cmd_run_shell_exec
}; };

View File

@ -37,7 +37,6 @@ const struct cmd_entry cmd_save_buffer_entry = {
"[-a] " CMD_BUFFER_USAGE " path", "[-a] " CMD_BUFFER_USAGE " path",
0, 0,
NULL, NULL,
NULL,
cmd_save_buffer_exec cmd_save_buffer_exec
}; };
@ -47,7 +46,6 @@ const struct cmd_entry cmd_show_buffer_entry = {
CMD_BUFFER_USAGE, CMD_BUFFER_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_save_buffer_exec cmd_save_buffer_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_layout_entry = {
"[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]", "[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
0, 0,
cmd_select_layout_key_binding, cmd_select_layout_key_binding,
NULL,
cmd_select_layout_exec cmd_select_layout_exec
}; };
@ -43,7 +42,6 @@ const struct cmd_entry cmd_next_layout_entry = {
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_layout_exec cmd_select_layout_exec
}; };
@ -53,7 +51,6 @@ const struct cmd_entry cmd_previous_layout_entry = {
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_layout_exec cmd_select_layout_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_pane_entry = {
"[-lDLRU] " CMD_TARGET_PANE_USAGE, "[-lDLRU] " CMD_TARGET_PANE_USAGE,
0, 0,
cmd_select_pane_key_binding, cmd_select_pane_key_binding,
NULL,
cmd_select_pane_exec cmd_select_pane_exec
}; };
@ -43,7 +42,6 @@ const struct cmd_entry cmd_last_pane_entry = {
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_pane_exec cmd_select_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_select_window_entry = {
"[-lnpT] " CMD_TARGET_WINDOW_USAGE, "[-lnpT] " CMD_TARGET_WINDOW_USAGE,
0, 0,
cmd_select_window_key_binding, cmd_select_window_key_binding,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };
@ -45,7 +44,6 @@ const struct cmd_entry cmd_next_window_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE, "[-a] " CMD_TARGET_SESSION_USAGE,
0, 0,
cmd_select_window_key_binding, cmd_select_window_key_binding,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };
@ -55,7 +53,6 @@ const struct cmd_entry cmd_previous_window_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE, "[-a] " CMD_TARGET_SESSION_USAGE,
0, 0,
cmd_select_window_key_binding, cmd_select_window_key_binding,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };
@ -65,7 +62,6 @@ const struct cmd_entry cmd_last_window_entry = {
CMD_TARGET_SESSION_USAGE, CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_send_keys_entry = {
"[-lR] " CMD_TARGET_PANE_USAGE " key ...", "[-lR] " CMD_TARGET_PANE_USAGE " key ...",
0, 0,
NULL, NULL,
NULL,
cmd_send_keys_exec cmd_send_keys_exec
}; };
@ -45,7 +44,6 @@ const struct cmd_entry cmd_send_prefix_entry = {
"[-2] " CMD_TARGET_PANE_USAGE, "[-2] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_send_keys_exec cmd_send_keys_exec
}; };

View File

@ -38,7 +38,6 @@ const struct cmd_entry cmd_server_info_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_server_info_exec cmd_server_info_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_buffer_entry = {
CMD_BUFFER_USAGE " data", CMD_BUFFER_USAGE " data",
0, 0,
NULL, NULL,
NULL,
cmd_set_buffer_exec cmd_set_buffer_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_environment_entry = {
"[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
0, 0,
NULL, NULL,
NULL,
cmd_set_environment_exec cmd_set_environment_exec
}; };

View File

@ -67,7 +67,6 @@ const struct cmd_entry cmd_set_option_entry = {
"[-agosquw] [-t target-session|target-window] option [value]", "[-agosquw] [-t target-session|target-window] option [value]",
0, 0,
NULL, NULL,
NULL,
cmd_set_option_exec cmd_set_option_exec
}; };
@ -77,7 +76,6 @@ const struct cmd_entry cmd_set_window_option_entry = {
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
0, 0,
NULL, NULL,
NULL,
cmd_set_option_exec cmd_set_option_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_environment_entry = {
"[-g] " CMD_TARGET_SESSION_USAGE " [name]", "[-g] " CMD_TARGET_SESSION_USAGE " [name]",
0, 0,
NULL, NULL,
NULL,
cmd_show_environment_exec cmd_show_environment_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_messages_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_show_messages_exec cmd_show_messages_exec
}; };

View File

@ -40,7 +40,6 @@ const struct cmd_entry cmd_show_options_entry = {
"[-gqsvw] [-t target-session|target-window] [option]", "[-gqsvw] [-t target-session|target-window] [option]",
0, 0,
NULL, NULL,
NULL,
cmd_show_options_exec cmd_show_options_exec
}; };
@ -50,7 +49,6 @@ const struct cmd_entry cmd_show_window_options_entry = {
"[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
0, 0,
NULL, NULL,
NULL,
cmd_show_options_exec cmd_show_options_exec
}; };

View File

@ -37,7 +37,6 @@ const struct cmd_entry cmd_source_file_entry = {
"path", "path",
0, 0,
NULL, NULL,
NULL,
cmd_source_file_exec cmd_source_file_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_split_window_entry = {
"[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] " "[-dhvP] [-c start-directory] [-F format] [-p percentage|-l size] "
CMD_TARGET_PANE_USAGE " [command]", CMD_TARGET_PANE_USAGE " [command]",
0, 0,
cmd_split_window_key_binding,
NULL, NULL,
cmd_split_window_exec cmd_split_window_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_start_server_entry = {
"", "",
CMD_STARTSERVER, CMD_STARTSERVER,
NULL, NULL,
NULL,
cmd_start_server_exec cmd_start_server_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_suspend_client_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_suspend_client_exec cmd_suspend_client_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_swap_pane_entry = {
"[-dDU] " CMD_SRCDST_PANE_USAGE, "[-dDU] " CMD_SRCDST_PANE_USAGE,
0, 0,
cmd_swap_pane_key_binding, cmd_swap_pane_key_binding,
NULL,
cmd_swap_pane_exec cmd_swap_pane_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_swap_window_entry = {
"[-d] " CMD_SRCDST_WINDOW_USAGE, "[-d] " CMD_SRCDST_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_swap_window_exec cmd_swap_window_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_switch_client_entry = {
"[-lnpr] [-c target-client] [-t target-session]", "[-lnpr] [-c target-client] [-t target-session]",
CMD_READONLY, CMD_READONLY,
cmd_switch_client_key_binding, cmd_switch_client_key_binding,
NULL,
cmd_switch_client_exec cmd_switch_client_exec
}; };

View File

@ -26,7 +26,6 @@
* Unbind key from command. * 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_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_unbind_key_table(struct cmd *, struct cmd_q *, int); 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", "[-acn] [-t key-table] key",
0, 0,
NULL, NULL,
cmd_unbind_key_check,
cmd_unbind_key_exec 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 enum cmd_retval
cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) 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; int key;
if (!args_has(args, 'a')) { 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]); key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE) { if (key == KEYC_NONE) {
cmdq_error(cmdq, "unknown key: %s", args->argv[0]); cmdq_error(cmdq, "unknown key: %s", args->argv[0]);
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
} else } else {
if (args->argc != 0) {
cmdq_error(cmdq, "key given with -a");
return (CMD_RETURN_ERROR);
}
key = KEYC_NONE; key = KEYC_NONE;
}
if (args_has(args, 't')) if (args_has(args, 't'))
return (cmd_unbind_key_table(self, cmdq, key)); return (cmd_unbind_key_table(self, cmdq, key));

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_unlink_window_entry = {
"[-k] " CMD_TARGET_WINDOW_USAGE, "[-k] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_unlink_window_exec cmd_unlink_window_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_wait_for_entry = {
"[-LSU] channel", "[-LSU] channel",
0, 0,
NULL, NULL,
NULL,
cmd_wait_for_exec cmd_wait_for_exec
}; };

2
cmd.c
View File

@ -254,8 +254,6 @@ cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause)
goto usage; goto usage;
if (entry->args_upper != -1 && args->argc > entry->args_upper) if (entry->args_upper != -1 && args->argc > entry->args_upper)
goto usage; goto usage;
if (entry->check != NULL && entry->check(args) != 0)
goto usage;
cmd = xcalloc(1, sizeof *cmd); cmd = xcalloc(1, sizeof *cmd);
cmd->entry = entry; cmd->entry = entry;

7
grid.c
View File

@ -268,8 +268,7 @@ grid_get_cell(struct grid *gd, u_int px, u_int py)
/* Set cell at relative position. */ /* Set cell at relative position. */
void void
grid_set_cell( grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
{ {
if (grid_check_y(gd, py) != 0) if (grid_check_y(gd, py) != 0)
return; return;
@ -657,8 +656,8 @@ grid_string_cells(struct grid *gd, u_int px, u_int py, u_int nx,
* available. * available.
*/ */
void void
grid_duplicate_lines( grid_duplicate_lines(struct grid *dst, u_int dy, struct grid *src, u_int sy,
struct grid *dst, u_int dy, struct grid *src, u_int sy, u_int ny) u_int ny)
{ {
struct grid_line *dstl, *srcl; struct grid_line *dstl, *srcl;
u_int yy; u_int yy;

7
tmux.1
View File

@ -99,7 +99,9 @@ Force
.Nm .Nm
to assume the terminal supports 256 colours. to assume the terminal supports 256 colours.
.It Fl C .It Fl C
Start in control mode. Start in control mode (see the
.Sx CONTROL MODE
section).
Given twice Given twice
.Xo ( Fl CC ) Xc .Xo ( Fl CC ) Xc
disables echo. disables echo.
@ -626,9 +628,10 @@ If it does exist, exit with 0.
Kill the Kill the
.Nm .Nm
server and clients and destroy all sessions. server and clients and destroy all sessions.
.It Ic kill-session .It Xo Ic kill-session
.Op Fl a .Op Fl a
.Op Fl t Ar target-session .Op Fl t Ar target-session
.Xc
Destroy the given session, closing any windows linked to it and no other Destroy the given session, closing any windows linked to it and no other
sessions, and detaching all clients attached to it. sessions, and detaching all clients attached to it.
If If

2
tmux.h
View File

@ -1005,6 +1005,7 @@ struct window {
#define WINDOW_REDRAW 0x4 #define WINDOW_REDRAW 0x4
#define WINDOW_SILENCE 0x8 #define WINDOW_SILENCE 0x8
#define WINDOW_ZOOMED 0x10 #define WINDOW_ZOOMED 0x10
#define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE)
struct options options; struct options options;
@ -1451,7 +1452,6 @@ struct cmd_entry {
int flags; int flags;
void (*key_binding)(struct cmd *, int); void (*key_binding)(struct cmd *, int);
int (*check)(struct args *);
enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); enum cmd_retval (*exec)(struct cmd *, struct cmd_q *);
}; };

View File

@ -1243,6 +1243,7 @@ winlink_clear_flags(struct winlink *wl)
continue; continue;
wm->flags &= ~WINLINK_ALERTFLAGS; wm->flags &= ~WINLINK_ALERTFLAGS;
wm->window->flags &= ~WINDOW_ALERTFLAGS;
server_status_session(s); server_status_session(s);
} }
} }