mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
Sync from OpenBSD.
This commit is contained in:
		@@ -89,10 +89,10 @@ cmd_server_info_exec(unused struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		ctx->print(ctx,"%2d: %s (%d, %d): %s [%ux%u %s bs=%hho "
 | 
			
		||||
		    "xterm=%u] [flags=0x%x/0x%x, references=%u]", i,
 | 
			
		||||
		    "class=%u] [flags=0x%x/0x%x, references=%u]", i,
 | 
			
		||||
		    c->tty.path, c->ibuf.fd, c->tty.fd, c->session->name,
 | 
			
		||||
		    c->tty.sx, c->tty.sy, c->tty.termname,
 | 
			
		||||
		    c->tty.tio.c_cc[VERASE], c->tty.xterm_version,
 | 
			
		||||
		    c->tty.tio.c_cc[VERASE], c->tty.class,
 | 
			
		||||
		    c->flags, c->tty.flags, c->references);
 | 
			
		||||
	}
 | 
			
		||||
	ctx->print(ctx, "%s", "");
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1189,7 +1189,7 @@ struct tty {
 | 
			
		||||
	struct client	*client;
 | 
			
		||||
 | 
			
		||||
	char		*path;
 | 
			
		||||
	u_int		 xterm_version;
 | 
			
		||||
	u_int		 class;
 | 
			
		||||
 | 
			
		||||
	u_int		 sx;
 | 
			
		||||
	u_int		 sy;
 | 
			
		||||
@@ -1633,8 +1633,8 @@ void	tty_pututf8(struct tty *, const struct grid_utf8 *);
 | 
			
		||||
void	tty_init(struct tty *, struct client *, int, char *);
 | 
			
		||||
int	tty_resize(struct tty *);
 | 
			
		||||
int	tty_set_size(struct tty *, u_int, u_int);
 | 
			
		||||
void	tty_set_class(struct tty *, u_int);
 | 
			
		||||
void	tty_start_tty(struct tty *);
 | 
			
		||||
void	tty_set_version(struct tty *, u_int);
 | 
			
		||||
void	tty_stop_tty(struct tty *);
 | 
			
		||||
void	tty_set_title(struct tty *, const char *);
 | 
			
		||||
void	tty_update_mode(struct tty *, int, struct screen *);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								tty-keys.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								tty-keys.c
									
									
									
									
									
								
							@@ -724,18 +724,17 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size)
 | 
			
		||||
int
 | 
			
		||||
tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
 | 
			
		||||
{
 | 
			
		||||
	u_int i, a, b;
 | 
			
		||||
	u_int i, class;
 | 
			
		||||
	char  tmp[64], *endptr;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * Primary device attributes are \033[?a;b and secondary are
 | 
			
		||||
	 * \033[>a;b;c. We only request attributes on xterm, so we only care
 | 
			
		||||
	 * about the middle values which is the xterm version.
 | 
			
		||||
	 * \033[>a;b;c.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	*size = 0;
 | 
			
		||||
 | 
			
		||||
	/* First three bytes are always \033[>. */
 | 
			
		||||
	/* First three bytes are always \033[?. */
 | 
			
		||||
	if (buf[0] != '\033')
 | 
			
		||||
		return (-1);
 | 
			
		||||
	if (len == 1)
 | 
			
		||||
@@ -760,22 +759,17 @@ tty_keys_device(struct tty *tty, const char *buf, size_t len, size_t *size)
 | 
			
		||||
	tmp[i] = '\0';
 | 
			
		||||
	*size = 4 + i;
 | 
			
		||||
 | 
			
		||||
	/* Only secondary is of interest. */
 | 
			
		||||
	if (buf[2] != '>')
 | 
			
		||||
	/* Only primary is of interest. */
 | 
			
		||||
	if (buf[2] != '?')
 | 
			
		||||
		return (0);
 | 
			
		||||
 | 
			
		||||
	/* Convert version numbers. */
 | 
			
		||||
	a = strtoul(tmp, &endptr, 10);
 | 
			
		||||
	if (*endptr == ';') {
 | 
			
		||||
		b = strtoul(endptr + 1, &endptr, 10);
 | 
			
		||||
		if (*endptr != '\0' && *endptr != ';')
 | 
			
		||||
			b = 0;
 | 
			
		||||
	} else
 | 
			
		||||
		a = b = 0;
 | 
			
		||||
	/* Convert service class. */
 | 
			
		||||
	class = strtoul(tmp, &endptr, 10);
 | 
			
		||||
	if (*endptr != ';')
 | 
			
		||||
		class = 0;
 | 
			
		||||
 | 
			
		||||
	log_debug("received xterm version %u", b);
 | 
			
		||||
	if (b < 500)
 | 
			
		||||
		tty_set_version(tty, b);
 | 
			
		||||
	log_debug("received service class %u", class);
 | 
			
		||||
	tty_set_class(tty, class);
 | 
			
		||||
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								tty.c
									
									
									
									
									
								
							@@ -224,7 +224,7 @@ tty_start_tty(struct tty *tty)
 | 
			
		||||
		tty_puts(tty, "\033[?1000l");
 | 
			
		||||
 | 
			
		||||
	if (tty_term_has(tty->term, TTYC_XT))
 | 
			
		||||
		tty_puts(tty, "\033[>c");
 | 
			
		||||
		tty_puts(tty, "\033[c");
 | 
			
		||||
 | 
			
		||||
	tty->cx = UINT_MAX;
 | 
			
		||||
	tty->cy = UINT_MAX;
 | 
			
		||||
@@ -240,11 +240,11 @@ tty_start_tty(struct tty *tty)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
tty_set_version(struct tty *tty, u_int version)
 | 
			
		||||
tty_set_class(struct tty *tty, u_int class)
 | 
			
		||||
{
 | 
			
		||||
	if (tty->xterm_version != 0)
 | 
			
		||||
	if (tty->class != 0)
 | 
			
		||||
		return;
 | 
			
		||||
	tty->xterm_version = version;
 | 
			
		||||
	tty->class = class;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
@@ -289,9 +289,6 @@ tty_stop_tty(struct tty *tty)
 | 
			
		||||
		tty_raw(tty, "\033[?1000l");
 | 
			
		||||
 | 
			
		||||
	tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
 | 
			
		||||
 | 
			
		||||
	if (tty->xterm_version > 270)
 | 
			
		||||
		tty_raw(tty, "\033[61;1\"p");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user