mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		| @@ -94,26 +94,31 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 		return (CMD_RETURN_ERROR); | 		return (CMD_RETURN_ERROR); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (args_has(args, 's')) { | 	tmp = args_get(args, 's'); | ||||||
| 		newname = format_single(item, args_get(args, 's'), c, NULL, | 	if (tmp != NULL) { | ||||||
| 		    NULL, NULL); | 		newname = format_single(item, tmp, c, NULL, NULL, NULL); | ||||||
| 		if (!session_check_name(newname)) { | 		if (!session_check_name(newname)) { | ||||||
| 			cmdq_error(item, "bad session name: %s", newname); | 			cmdq_error(item, "bad session name: %s", newname); | ||||||
| 			goto fail; | 			goto fail; | ||||||
| 		} | 		} | ||||||
| 		if ((as = session_find(newname)) != NULL) { | 	} | ||||||
| 	if (args_has(args, 'A')) { | 	if (args_has(args, 'A')) { | ||||||
| 				retval = cmd_attach_session(item, | 		if (newname != NULL) | ||||||
| 				    newname, args_has(args, 'D'), | 			as = session_find(newname); | ||||||
| 				    args_has(args, 'X'), 0, NULL, | 		else | ||||||
|  | 			as = item->target.s; | ||||||
|  | 		if (as != NULL) { | ||||||
|  | 			retval = cmd_attach_session(item, as->name, | ||||||
|  | 			    args_has(args, 'D'), args_has(args, 'X'), 0, NULL, | ||||||
| 			    args_has(args, 'E')); | 			    args_has(args, 'E')); | ||||||
| 			free(newname); | 			free(newname); | ||||||
| 			return (retval); | 			return (retval); | ||||||
| 		} | 		} | ||||||
|  | 	} | ||||||
|  | 	if (newname != NULL && session_find(newname) != NULL) { | ||||||
| 		cmdq_error(item, "duplicate session: %s", newname); | 		cmdq_error(item, "duplicate session: %s", newname); | ||||||
| 		goto fail; | 		goto fail; | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	/* Is this going to be part of a session group? */ | 	/* Is this going to be part of a session group? */ | ||||||
| 	group = args_get(args, 't'); | 	group = args_get(args, 't'); | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								input-keys.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								input-keys.c
									
									
									
									
									
								
							| @@ -42,9 +42,6 @@ struct input_key_ent { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| static const struct input_key_ent input_keys[] = { | static const struct input_key_ent input_keys[] = { | ||||||
| 	/* Backspace key. */ |  | ||||||
| 	{ KEYC_BSPACE,		"\177",		0 }, |  | ||||||
|  |  | ||||||
| 	/* Paste keys. */ | 	/* Paste keys. */ | ||||||
| 	{ KEYC_PASTE_START,	"\033[200~",	0 }, | 	{ KEYC_PASTE_START,	"\033[200~",	0 }, | ||||||
| 	{ KEYC_PASTE_END,	"\033[201~",	0 }, | 	{ KEYC_PASTE_END,	"\033[201~",	0 }, | ||||||
| @@ -179,6 +176,13 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m) | |||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/* Is this backspace? */ | ||||||
|  | 	if ((key & KEYC_MASK_KEY) == KEYC_BSPACE) { | ||||||
|  | 		key = options_get_number(global_options, "backspace"); | ||||||
|  | 		if (key >= 0x7f) | ||||||
|  | 			key = '\177'; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| 	 * If this is a normal 7-bit key, just send it, with a leading escape | 	 * If this is a normal 7-bit key, just send it, with a leading escape | ||||||
| 	 * if necessary. If it is a UTF-8 key, split it and send it. | 	 * if necessary. If it is a UTF-8 key, split it and send it. | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								key-string.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								key-string.c
									
									
									
									
									
								
							| @@ -159,7 +159,7 @@ key_string_get_modifiers(const char **string) | |||||||
| key_code | key_code | ||||||
| key_string_lookup_string(const char *string) | key_string_lookup_string(const char *string) | ||||||
| { | { | ||||||
| 	static const char	*other = "!#()+,-.0123456789:;<=>?'\r\t"; | 	static const char	*other = "!#()+,-.0123456789:;<=>'\r\t"; | ||||||
| 	key_code		 key; | 	key_code		 key; | ||||||
| 	u_int			 u; | 	u_int			 u; | ||||||
| 	key_code		 modifiers; | 	key_code		 modifiers; | ||||||
| @@ -196,7 +196,7 @@ key_string_lookup_string(const char *string) | |||||||
| 	/* Is this a standard ASCII key? */ | 	/* Is this a standard ASCII key? */ | ||||||
| 	if (string[1] == '\0' && (u_char)string[0] <= 127) { | 	if (string[1] == '\0' && (u_char)string[0] <= 127) { | ||||||
| 		key = (u_char)string[0]; | 		key = (u_char)string[0]; | ||||||
| 		if (key < 32 || key == 127) | 		if (key < 32) | ||||||
| 			return (KEYC_UNKNOWN); | 			return (KEYC_UNKNOWN); | ||||||
| 	} else { | 	} else { | ||||||
| 		/* Try as a UTF-8 key. */ | 		/* Try as a UTF-8 key. */ | ||||||
| @@ -226,6 +226,8 @@ key_string_lookup_string(const char *string) | |||||||
| 			key -= 64; | 			key -= 64; | ||||||
| 		else if (key == 32) | 		else if (key == 32) | ||||||
| 			key = 0; | 			key = 0; | ||||||
|  | 		else if (key == '?') | ||||||
|  | 			key = 127; | ||||||
| 		else if (key == 63) | 		else if (key == 63) | ||||||
| 			key = KEYC_BSPACE; | 			key = KEYC_BSPACE; | ||||||
| 		else | 		else | ||||||
| @@ -329,7 +331,7 @@ key_string_lookup_key(key_code key) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Invalid keys are errors. */ | 	/* Invalid keys are errors. */ | ||||||
| 	if (key == 127 || key > 255) { | 	if (key > 255) { | ||||||
| 		snprintf(out, sizeof out, "Invalid#%llx", key); | 		snprintf(out, sizeof out, "Invalid#%llx", key); | ||||||
| 		return (out); | 		return (out); | ||||||
| 	} | 	} | ||||||
| @@ -343,7 +345,9 @@ key_string_lookup_key(key_code key) | |||||||
| 	} else if (key >= 32 && key <= 126) { | 	} else if (key >= 32 && key <= 126) { | ||||||
| 		tmp[0] = key; | 		tmp[0] = key; | ||||||
| 		tmp[1] = '\0'; | 		tmp[1] = '\0'; | ||||||
| 	} else if (key >= 128) | 	} else if (key == 127) | ||||||
|  | 		xsnprintf(tmp, sizeof tmp, "C-?"); | ||||||
|  | 	else if (key >= 128) | ||||||
| 		xsnprintf(tmp, sizeof tmp, "\\%llo", key); | 		xsnprintf(tmp, sizeof tmp, "\\%llo", key); | ||||||
|  |  | ||||||
| 	strlcat(out, tmp, sizeof out); | 	strlcat(out, tmp, sizeof out); | ||||||
|   | |||||||
| @@ -146,6 +146,12 @@ static const char *options_table_status_format_default[] = { | |||||||
| /* Top-level options. */ | /* Top-level options. */ | ||||||
| const struct options_table_entry options_table[] = { | const struct options_table_entry options_table[] = { | ||||||
| 	/* Server options. */ | 	/* Server options. */ | ||||||
|  | 	{ .name = "backspace", | ||||||
|  | 	  .type = OPTIONS_TABLE_KEY, | ||||||
|  | 	  .scope = OPTIONS_TABLE_SERVER, | ||||||
|  | 	  .default_num = '\177', | ||||||
|  | 	}, | ||||||
|  |  | ||||||
| 	{ .name = "buffer-limit", | 	{ .name = "buffer-limit", | ||||||
| 	  .type = OPTIONS_TABLE_NUMBER, | 	  .type = OPTIONS_TABLE_NUMBER, | ||||||
| 	  .scope = OPTIONS_TABLE_SERVER, | 	  .scope = OPTIONS_TABLE_SERVER, | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								spawn.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								spawn.c
									
									
									
									
									
								
							| @@ -215,6 +215,7 @@ spawn_pane(struct spawn_context *sc, char **cause) | |||||||
| 	u_int			  hlimit; | 	u_int			  hlimit; | ||||||
| 	struct winsize		  ws; | 	struct winsize		  ws; | ||||||
| 	sigset_t		  set, oldset; | 	sigset_t		  set, oldset; | ||||||
|  | 	key_code		  key; | ||||||
|  |  | ||||||
| 	spawn_log(__func__, sc); | 	spawn_log(__func__, sc); | ||||||
|  |  | ||||||
| @@ -376,13 +377,17 @@ spawn_pane(struct spawn_context *sc, char **cause) | |||||||
|  |  | ||||||
| 	/* | 	/* | ||||||
| 	 * Update terminal escape characters from the session if available and | 	 * Update terminal escape characters from the session if available and | ||||||
| 	 * force VERASE to tmux's \177. | 	 * force VERASE to tmux's backspace. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (tcgetattr(STDIN_FILENO, &now) != 0) | 	if (tcgetattr(STDIN_FILENO, &now) != 0) | ||||||
| 		_exit(1); | 		_exit(1); | ||||||
| 	if (s->tio != NULL) | 	if (s->tio != NULL) | ||||||
| 		memcpy(now.c_cc, s->tio->c_cc, sizeof now.c_cc); | 		memcpy(now.c_cc, s->tio->c_cc, sizeof now.c_cc); | ||||||
|  | 	key = options_get_number(global_options, "backspace"); | ||||||
|  | 	if (key >= 0x7f) | ||||||
| 		now.c_cc[VERASE] = '\177'; | 		now.c_cc[VERASE] = '\177'; | ||||||
|  | 	else | ||||||
|  | 		now.c_cc[VERASE] = key; | ||||||
| 	if (tcsetattr(STDIN_FILENO, TCSANOW, &now) != 0) | 	if (tcsetattr(STDIN_FILENO, TCSANOW, &now) != 0) | ||||||
| 		_exit(1); | 		_exit(1); | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tmux.1
									
									
									
									
									
								
							| @@ -2930,6 +2930,10 @@ omitted to toggle). | |||||||
| .Pp | .Pp | ||||||
| Available server options are: | Available server options are: | ||||||
| .Bl -tag -width Ds | .Bl -tag -width Ds | ||||||
|  | .It Ic backspace Ar key | ||||||
|  | Set the key sent by | ||||||
|  | .Nm | ||||||
|  | for backspace. | ||||||
| .It Ic buffer-limit Ar number | .It Ic buffer-limit Ar number | ||||||
| Set the number of buffers; as new buffers are added to the top of the stack, | Set the number of buffers; as new buffers are added to the top of the stack, | ||||||
| old ones are removed from the bottom if necessary to maintain this maximum | old ones are removed from the bottom if necessary to maintain this maximum | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								tty.c
									
									
									
									
									
								
							| @@ -2106,7 +2106,9 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) | |||||||
| 		if ((u_int) abs(change) > cx && tty_term_has(term, TTYC_HPA)) { | 		if ((u_int) abs(change) > cx && tty_term_has(term, TTYC_HPA)) { | ||||||
| 			tty_putcode1(tty, TTYC_HPA, cx); | 			tty_putcode1(tty, TTYC_HPA, cx); | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} else if (change > 0 && tty_term_has(term, TTYC_CUB)) { | 		} else if (change > 0 && | ||||||
|  | 		    tty_term_has(term, TTYC_CUB) && | ||||||
|  | 		    !tty_use_margin(tty)) { | ||||||
| 			if (change == 2 && tty_term_has(term, TTYC_CUB1)) { | 			if (change == 2 && tty_term_has(term, TTYC_CUB1)) { | ||||||
| 				tty_putcode(tty, TTYC_CUB1); | 				tty_putcode(tty, TTYC_CUB1); | ||||||
| 				tty_putcode(tty, TTYC_CUB1); | 				tty_putcode(tty, TTYC_CUB1); | ||||||
| @@ -2114,7 +2116,9 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy) | |||||||
| 			} | 			} | ||||||
| 			tty_putcode1(tty, TTYC_CUB, change); | 			tty_putcode1(tty, TTYC_CUB, change); | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} else if (change < 0 && tty_term_has(term, TTYC_CUF)) { | 		} else if (change < 0 && | ||||||
|  | 		    tty_term_has(term, TTYC_CUF) && | ||||||
|  | 		    !tty_use_margin(tty)) { | ||||||
| 			tty_putcode1(tty, TTYC_CUF, -change); | 			tty_putcode1(tty, TTYC_CUF, -change); | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Thomas Adam
					Thomas Adam