mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add a format client_prefix which is 1 if prefix key has been pressed, used for
example #{?client_prefix,X,Y}. Also a few extra server_client_status needed.
			
			
This commit is contained in:
		
							
								
								
									
										2
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								format.c
									
									
									
									
									
								
							@@ -322,6 +322,8 @@ format_client(struct format_tree *ft, struct client *c)
 | 
			
		||||
	*strchr(tim, '\n') = '\0';
 | 
			
		||||
	format_add(ft, "client_activity_string", "%s", tim);
 | 
			
		||||
 | 
			
		||||
	format_add(ft, "client_prefix", "%d", !!(c->flags & CLIENT_PREFIX));
 | 
			
		||||
 | 
			
		||||
	if (c->tty.flags & TTY_UTF8)
 | 
			
		||||
		format_add(ft, "client_utf8", "%d", 1);
 | 
			
		||||
	else
 | 
			
		||||
 
 | 
			
		||||
@@ -417,6 +417,7 @@ server_client_handle_key(struct client *c, int key)
 | 
			
		||||
	if (!(c->flags & CLIENT_PREFIX)) {
 | 
			
		||||
		if (isprefix) {
 | 
			
		||||
			c->flags |= CLIENT_PREFIX;
 | 
			
		||||
			server_status_client(c);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@@ -431,6 +432,7 @@ server_client_handle_key(struct client *c, int key)
 | 
			
		||||
 | 
			
		||||
	/* Prefix key already pressed. Reset prefix and lookup key. */
 | 
			
		||||
	c->flags &= ~CLIENT_PREFIX;
 | 
			
		||||
	server_status_client(c);
 | 
			
		||||
	if ((bd = key_bindings_lookup(key | KEYC_PREFIX)) == NULL) {
 | 
			
		||||
		/* If repeating, treat this as a key, else ignore. */
 | 
			
		||||
		if (c->flags & CLIENT_REPEAT) {
 | 
			
		||||
@@ -586,8 +588,11 @@ server_client_repeat_timer(unused int fd, unused short events, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct client	*c = data;
 | 
			
		||||
 | 
			
		||||
	if (c->flags & CLIENT_REPEAT)
 | 
			
		||||
	if (c->flags & CLIENT_REPEAT) {
 | 
			
		||||
		if (c->flags & CLIENT_PREFIX)
 | 
			
		||||
			server_status_client(c);
 | 
			
		||||
		c->flags &= ~(CLIENT_PREFIX|CLIENT_REPEAT);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Check if client should be exited. */
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								status.c
									
									
									
									
									
								
							@@ -437,8 +437,7 @@ status_replace1(struct client *c, struct session *s, struct winlink *wl,
 | 
			
		||||
	case 'P':
 | 
			
		||||
		if (window_pane_index(wp, &idx) != 0)
 | 
			
		||||
			fatalx("index not found");
 | 
			
		||||
		xsnprintf(
 | 
			
		||||
		    tmp, sizeof tmp, "%u", idx);
 | 
			
		||||
		xsnprintf(tmp, sizeof tmp, "%u", idx);
 | 
			
		||||
		ptr = tmp;
 | 
			
		||||
		goto do_replace;
 | 
			
		||||
	case 'S':
 | 
			
		||||
@@ -539,6 +538,7 @@ status_replace(struct client *c, struct session *s, struct winlink *wl,
 | 
			
		||||
	*optr = '\0';
 | 
			
		||||
 | 
			
		||||
	ft = format_create();
 | 
			
		||||
	format_client(ft, c);
 | 
			
		||||
	format_session(ft, s);
 | 
			
		||||
	format_winlink(ft, s, wl);
 | 
			
		||||
	format_window_pane(ft, wp);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tmux.1
									
									
									
									
									
								
							@@ -2370,6 +2370,7 @@ may contain any of the following special character sequences:
 | 
			
		||||
.It Li "#S" Ta "Session name"
 | 
			
		||||
.It Li "#T" Ta "Current pane title"
 | 
			
		||||
.It Li "#W" Ta "Current window name"
 | 
			
		||||
.It Li "'^" Ta "Prefix key if pressed or same length as spaces"
 | 
			
		||||
.It Li "##" Ta "A literal" Ql #
 | 
			
		||||
.El
 | 
			
		||||
.Pp
 | 
			
		||||
@@ -2939,6 +2940,7 @@ The following variables are available, where appropriate:
 | 
			
		||||
.It Li "client_created_string" Ta "String time client created"
 | 
			
		||||
.It Li "client_cwd" Ta "Working directory of client"
 | 
			
		||||
.It Li "client_height" Ta "Height of client"
 | 
			
		||||
.It Li "client_prefix" Ta "1 if prefix key has been pressed"
 | 
			
		||||
.It Li "client_readonly" Ta "1 if client is readonly"
 | 
			
		||||
.It Li "client_termname" Ta "Terminal name of client"
 | 
			
		||||
.It Li "client_tty" Ta "Pseudo terminal of client"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user