mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	send-prefix command.
This commit is contained in:
		
							
								
								
									
										3
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								CHANGES
									
									
									
									
									
								
							@@ -1,5 +1,6 @@
 | 
			
		||||
12 October 2007
 | 
			
		||||
 | 
			
		||||
* (nicm) send-prefix command. Bound to C-b by default.
 | 
			
		||||
* (nicm) set status, status-fg, status-bg commands. fg and bg are as a number
 | 
			
		||||
  from 0 to 7. status may be 0/1/on/off/yes/no.
 | 
			
		||||
* (nicm) Make status line mark window in yellow on bell.
 | 
			
		||||
@@ -124,5 +125,5 @@
 | 
			
		||||
  (including mutt, emacs). No status bar yet and no key remapping or other
 | 
			
		||||
  customisation.
 | 
			
		||||
 | 
			
		||||
$Id: CHANGES,v 1.38 2007-10-12 12:32:34 nicm Exp $
 | 
			
		||||
$Id: CHANGES,v 1.39 2007-10-12 13:03:58 nicm Exp $
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
# $Id: Makefile,v 1.25 2007-10-10 19:45:20 nicm Exp $
 | 
			
		||||
# $Id: Makefile,v 1.26 2007-10-12 13:03:58 nicm Exp $
 | 
			
		||||
 | 
			
		||||
.SUFFIXES: .c .o .y .h
 | 
			
		||||
.PHONY: clean
 | 
			
		||||
@@ -22,7 +22,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
 | 
			
		||||
      cmd-list-sessions.c cmd-new-window.c cmd-next-window.c cmd-bind-key.c \
 | 
			
		||||
      cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
 | 
			
		||||
      cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
 | 
			
		||||
      cmd-list-windows.c cmd-attach-session.c
 | 
			
		||||
      cmd-list-windows.c cmd-attach-session.c cmd-send-prefix.c
 | 
			
		||||
 | 
			
		||||
YACC= yacc -d
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								TODO
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								TODO
									
									
									
									
									
								
							@@ -58,6 +58,5 @@
 | 
			
		||||
	kill window (C-b backsp)
 | 
			
		||||
	kill session (no not bind by default)
 | 
			
		||||
	set shell
 | 
			
		||||
	send prefix
 | 
			
		||||
- handle tmux in tmux (check $TMUX and abort)
 | 
			
		||||
- check for some reqd terminfo caps on startup
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								cmd-send-prefix.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								cmd-send-prefix.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
/* $Id: cmd-send-prefix.c,v 1.1 2007-10-12 13:03:58 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 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 <getopt.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#include "tmux.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Send prefix key as a key.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void	cmd_send_prefix_exec(void *, struct cmd_ctx *);
 | 
			
		||||
 | 
			
		||||
const struct cmd_entry cmd_send_prefix_entry = {
 | 
			
		||||
	"send-prefix", NULL, 0,
 | 
			
		||||
	NULL,
 | 
			
		||||
	NULL,
 | 
			
		||||
	cmd_send_prefix_exec,
 | 
			
		||||
	NULL,
 | 
			
		||||
	NULL,
 | 
			
		||||
	NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
cmd_send_prefix_exec(unused void *ptr, struct cmd_ctx *ctx)
 | 
			
		||||
{
 | 
			
		||||
	struct client	*c = ctx->client;
 | 
			
		||||
 | 
			
		||||
	if (!(ctx->flags & CMD_KEY)) {
 | 
			
		||||
		server_write_client(c, MSG_EXIT, NULL, 0);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	window_key(c->session->window, prefix_key);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										5
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								cmd.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd.c,v 1.14 2007-10-04 22:04:01 nicm Exp $ */
 | 
			
		||||
/* $Id: cmd.c,v 1.15 2007-10-12 13:03:58 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -37,7 +37,8 @@ const struct cmd_entry *cmd_table[] = {
 | 
			
		||||
	&cmd_previous_window_entry,
 | 
			
		||||
	&cmd_rename_window_entry,
 | 
			
		||||
	&cmd_select_window_entry,
 | 
			
		||||
	&cmd_set_option_entry,
 | 
			
		||||
	&cmd_send_prefix_entry,
 | 
			
		||||
	&cmd_set_option_entry,	
 | 
			
		||||
	&cmd_unbind_key_entry,
 | 
			
		||||
	NULL
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: key-bindings.c,v 1.7 2007-10-04 11:55:55 nicm Exp $ */
 | 
			
		||||
/* $Id: key-bindings.c,v 1.8 2007-10-12 13:03:58 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -103,6 +103,7 @@ key_bindings_init(void)
 | 
			
		||||
		{ '7', &cmd_select_window_entry, cmd_select_window_default },
 | 
			
		||||
		{ '8', &cmd_select_window_entry, cmd_select_window_default },
 | 
			
		||||
		{ '9', &cmd_select_window_entry, cmd_select_window_default },
 | 
			
		||||
		{ META, &cmd_send_prefix_entry, NULL },
 | 
			
		||||
/*		{ 'R', &cmd_refresh_client_entry },
 | 
			
		||||
		{ 'r', &cmd_refresh_client_entry },
 | 
			
		||||
		{ 'I', &cmd_windo_info_entry },
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: tmux.h,v 1.55 2007-10-12 12:08:51 nicm Exp $ */
 | 
			
		||||
/* $Id: tmux.h,v 1.56 2007-10-12 13:03:58 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -525,9 +525,10 @@ extern const struct cmd_entry cmd_next_window_entry;
 | 
			
		||||
extern const struct cmd_entry cmd_previous_window_entry;
 | 
			
		||||
extern const struct cmd_entry cmd_rename_window_entry;
 | 
			
		||||
extern const struct cmd_entry cmd_select_window_entry;
 | 
			
		||||
void	cmd_select_window_default(void **, int);
 | 
			
		||||
extern const struct cmd_entry cmd_send_prefix_entry;
 | 
			
		||||
extern const struct cmd_entry cmd_set_option_entry;
 | 
			
		||||
extern const struct cmd_entry cmd_unbind_key_entry;
 | 
			
		||||
void	cmd_select_window_default(void **, int);
 | 
			
		||||
 | 
			
		||||
/* client.c */
 | 
			
		||||
int	 client_init(char *, struct client_ctx *, int);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user