mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Separate key flags and modifiers, log key flags, make the "xterm" flag
more explicit and fix M- keys with a leading escape.
This commit is contained in:
		| @@ -73,7 +73,7 @@ cmd_list_keys_get_width(const char *tablename, key_code only) | |||||||
| 			bd = key_bindings_next(table, bd); | 			bd = key_bindings_next(table, bd); | ||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
| 		width = utf8_cstrwidth(key_string_lookup_key(bd->key)); | 		width = utf8_cstrwidth(key_string_lookup_key(bd->key, 0)); | ||||||
| 		if (width > keywidth) | 		if (width > keywidth) | ||||||
| 			keywidth = width; | 			keywidth = width; | ||||||
|  |  | ||||||
| @@ -106,7 +106,7 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args, | |||||||
| 			continue; | 			continue; | ||||||
| 		} | 		} | ||||||
| 		found = 1; | 		found = 1; | ||||||
| 		key = key_string_lookup_key(bd->key); | 		key = key_string_lookup_key(bd->key, 0); | ||||||
|  |  | ||||||
| 		if (bd->note == NULL || *bd->note == '\0') | 		if (bd->note == NULL || *bd->note == '\0') | ||||||
| 			note = cmd_list_print(bd->cmdlist, 1); | 			note = cmd_list_print(bd->cmdlist, 1); | ||||||
| @@ -135,7 +135,7 @@ cmd_list_keys_get_prefix(struct args *args, key_code *prefix) | |||||||
| 	*prefix = options_get_number(global_s_options, "prefix"); | 	*prefix = options_get_number(global_s_options, "prefix"); | ||||||
| 	if (!args_has(args, 'P')) { | 	if (!args_has(args, 'P')) { | ||||||
| 		if (*prefix != KEYC_NONE) | 		if (*prefix != KEYC_NONE) | ||||||
| 			xasprintf(&s, "%s ", key_string_lookup_key(*prefix)); | 			xasprintf(&s, "%s ", key_string_lookup_key(*prefix, 0)); | ||||||
| 		else | 		else | ||||||
| 			s = xstrdup(""); | 			s = xstrdup(""); | ||||||
| 	} else | 	} else | ||||||
| @@ -221,7 +221,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 				bd = key_bindings_next(table, bd); | 				bd = key_bindings_next(table, bd); | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			key = args_escape(key_string_lookup_key(bd->key)); | 			key = args_escape(key_string_lookup_key(bd->key, 0)); | ||||||
|  |  | ||||||
| 			if (bd->flags & KEY_BINDING_REPEAT) | 			if (bd->flags & KEY_BINDING_REPEAT) | ||||||
| 				repeat = 1; | 				repeat = 1; | ||||||
| @@ -255,7 +255,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item) | |||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			found = 1; | 			found = 1; | ||||||
| 			key = args_escape(key_string_lookup_key(bd->key)); | 			key = args_escape(key_string_lookup_key(bd->key, 0)); | ||||||
|  |  | ||||||
| 			if (!repeat) | 			if (!repeat) | ||||||
| 				r = ""; | 				r = ""; | ||||||
|   | |||||||
| @@ -547,7 +547,7 @@ cmdq_add_message(struct cmdq_item *item) | |||||||
| 	if (c != NULL) { | 	if (c != NULL) { | ||||||
| 		name = c->name; | 		name = c->name; | ||||||
| 		if (c->session != NULL && state->event.key != KEYC_NONE) { | 		if (c->session != NULL && state->event.key != KEYC_NONE) { | ||||||
| 			key = key_string_lookup_key(state->event.key); | 			key = key_string_lookup_key(state->event.key, 0); | ||||||
| 			server_add_message("%s key %s: %s", name, key, tmp); | 			server_add_message("%s key %s: %s", name, key, tmp); | ||||||
| 		} else | 		} else | ||||||
| 			server_add_message("%s command: %s", name, tmp); | 			server_add_message("%s command: %s", name, tmp); | ||||||
|   | |||||||
| @@ -71,15 +71,13 @@ cmd_send_keys_inject_key(struct cmdq_item *item, struct cmdq_item *after, | |||||||
|  |  | ||||||
| 	wme = TAILQ_FIRST(&wp->modes); | 	wme = TAILQ_FIRST(&wp->modes); | ||||||
| 	if (wme == NULL || wme->mode->key_table == NULL) { | 	if (wme == NULL || wme->mode->key_table == NULL) { | ||||||
| 		if (options_get_number(wp->window->options, "xterm-keys")) |  | ||||||
| 			key |= KEYC_XTERM; |  | ||||||
| 		if (window_pane_key(wp, tc, s, wl, key, NULL) != 0) | 		if (window_pane_key(wp, tc, s, wl, key, NULL) != 0) | ||||||
| 			return (NULL); | 			return (NULL); | ||||||
| 		return (item); | 		return (item); | ||||||
| 	} | 	} | ||||||
| 	table = key_bindings_get_table(wme->mode->key_table(wme), 1); | 	table = key_bindings_get_table(wme->mode->key_table(wme), 1); | ||||||
|  |  | ||||||
| 	bd = key_bindings_get(table, key & ~KEYC_XTERM); | 	bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS); | ||||||
| 	if (bd != NULL) { | 	if (bd != NULL) { | ||||||
| 		table->references++; | 		table->references++; | ||||||
| 		after = key_bindings_dispatch(bd, after, tc, NULL, target); | 		after = key_bindings_dispatch(bd, after, tc, NULL, target); | ||||||
|   | |||||||
| @@ -190,7 +190,7 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat, | |||||||
|  |  | ||||||
| 	table = key_bindings_get_table(name, 1); | 	table = key_bindings_get_table(name, 1); | ||||||
|  |  | ||||||
| 	bd = key_bindings_get(table, key & ~KEYC_XTERM); | 	bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS); | ||||||
| 	if (bd != NULL) { | 	if (bd != NULL) { | ||||||
| 		RB_REMOVE(key_bindings, &table->key_bindings, bd); | 		RB_REMOVE(key_bindings, &table->key_bindings, bd); | ||||||
| 		key_bindings_free(bd); | 		key_bindings_free(bd); | ||||||
| @@ -217,7 +217,7 @@ key_bindings_remove(const char *name, key_code key) | |||||||
| 	if (table == NULL) | 	if (table == NULL) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	bd = key_bindings_get(table, key & ~KEYC_XTERM); | 	bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS); | ||||||
| 	if (bd == NULL) | 	if (bd == NULL) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										51
									
								
								key-string.c
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								key-string.c
									
									
									
									
									
								
							| @@ -143,7 +143,7 @@ key_string_get_modifiers(const char **string) | |||||||
| 			break; | 			break; | ||||||
| 		case 'M': | 		case 'M': | ||||||
| 		case 'm': | 		case 'm': | ||||||
| 			modifiers |= KEYC_ESCAPE; | 			modifiers |= KEYC_META; | ||||||
| 			break; | 			break; | ||||||
| 		case 'S': | 		case 'S': | ||||||
| 		case 's': | 		case 's': | ||||||
| @@ -212,7 +212,7 @@ key_string_lookup_string(const char *string) | |||||||
| 				return (KEYC_UNKNOWN); | 				return (KEYC_UNKNOWN); | ||||||
| 			if (utf8_combine(&ud, &wc) != UTF8_DONE) | 			if (utf8_combine(&ud, &wc) != UTF8_DONE) | ||||||
| 				return (KEYC_UNKNOWN); | 				return (KEYC_UNKNOWN); | ||||||
| 			return (wc | modifiers); | 			return (wc|modifiers); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		/* Otherwise look the key up in the table. */ | 		/* Otherwise look the key up in the table. */ | ||||||
| @@ -236,14 +236,15 @@ key_string_lookup_string(const char *string) | |||||||
| 		modifiers &= ~KEYC_CTRL; | 		modifiers &= ~KEYC_CTRL; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	return (key | modifiers); | 	return (key|modifiers); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Convert a key code into string format, with prefix if necessary. */ | /* Convert a key code into string format, with prefix if necessary. */ | ||||||
| const char * | const char * | ||||||
| key_string_lookup_key(key_code key) | key_string_lookup_key(key_code key, int with_flags) | ||||||
| { | { | ||||||
| 	static char		 out[32]; | 	key_code		 saved = key; | ||||||
|  | 	static char		 out[64]; | ||||||
| 	char			 tmp[8]; | 	char			 tmp[8]; | ||||||
| 	const char		*s; | 	const char		*s; | ||||||
| 	u_int			 i; | 	u_int			 i; | ||||||
| @@ -255,25 +256,27 @@ key_string_lookup_key(key_code key) | |||||||
| 	/* Literal keys are themselves. */ | 	/* Literal keys are themselves. */ | ||||||
| 	if (key & KEYC_LITERAL) { | 	if (key & KEYC_LITERAL) { | ||||||
| 		snprintf(out, sizeof out, "%c", (int)(key & 0xff)); | 		snprintf(out, sizeof out, "%c", (int)(key & 0xff)); | ||||||
| 		return (out); | 		goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Display C-@ as C-Space. */ | 	/* Display C-@ as C-Space. */ | ||||||
| 	if ((key & KEYC_MASK_KEY) == 0) | 	if ((key & (KEYC_MASK_KEY|KEYC_MASK_MODIFIERS)) == 0) | ||||||
| 		key = ' ' | KEYC_CTRL | (key & KEYC_MASK_MOD); | 		key = ' '|KEYC_CTRL; | ||||||
|  |  | ||||||
| 	/* Fill in the modifiers. */ | 	/* Fill in the modifiers. */ | ||||||
| 	if (key & KEYC_CTRL) | 	if (key & KEYC_CTRL) | ||||||
| 		strlcat(out, "C-", sizeof out); | 		strlcat(out, "C-", sizeof out); | ||||||
| 	if (key & KEYC_ESCAPE) | 	if (key & KEYC_META) | ||||||
| 		strlcat(out, "M-", sizeof out); | 		strlcat(out, "M-", sizeof out); | ||||||
| 	if (key & KEYC_SHIFT) | 	if (key & KEYC_SHIFT) | ||||||
| 		strlcat(out, "S-", sizeof out); | 		strlcat(out, "S-", sizeof out); | ||||||
| 	key &= KEYC_MASK_KEY; | 	key &= KEYC_MASK_KEY; | ||||||
|  |  | ||||||
| 	/* Handle no key. */ | 	/* Handle no key. */ | ||||||
| 	if (key == KEYC_NONE) | 	if (key == KEYC_NONE) { | ||||||
| 		return ("None"); | 		s = "None"; | ||||||
|  | 		goto append; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	/* Handle special keys. */ | 	/* Handle special keys. */ | ||||||
| 	if (key == KEYC_UNKNOWN) { | 	if (key == KEYC_UNKNOWN) { | ||||||
| @@ -331,7 +334,7 @@ key_string_lookup_key(key_code key) | |||||||
| 	if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) { | 	if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) { | ||||||
| 		snprintf(tmp, sizeof tmp, "User%u", (u_int)(key - KEYC_USER)); | 		snprintf(tmp, sizeof tmp, "User%u", (u_int)(key - KEYC_USER)); | ||||||
| 		strlcat(out, tmp, sizeof out); | 		strlcat(out, tmp, sizeof out); | ||||||
| 		return (out); | 		goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Try the key against the string table. */ | 	/* Try the key against the string table. */ | ||||||
| @@ -341,7 +344,7 @@ key_string_lookup_key(key_code key) | |||||||
| 	} | 	} | ||||||
| 	if (i != nitems(key_string_table)) { | 	if (i != nitems(key_string_table)) { | ||||||
| 		strlcat(out, key_string_table[i].string, sizeof out); | 		strlcat(out, key_string_table[i].string, sizeof out); | ||||||
| 		return (out); | 		goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Is this a UTF-8 key? */ | 	/* Is this a UTF-8 key? */ | ||||||
| @@ -350,14 +353,14 @@ key_string_lookup_key(key_code key) | |||||||
| 			off = strlen(out); | 			off = strlen(out); | ||||||
| 			memcpy(out + off, ud.data, ud.size); | 			memcpy(out + off, ud.data, ud.size); | ||||||
| 			out[off + ud.size] = '\0'; | 			out[off + ud.size] = '\0'; | ||||||
| 			return (out); | 			goto out; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Invalid keys are errors. */ | 	/* Invalid keys are errors. */ | ||||||
| 	if (key > 255) { | 	if (key > 255) { | ||||||
| 		snprintf(out, sizeof out, "Invalid#%llx", key); | 		snprintf(out, sizeof out, "Invalid#%llx", key); | ||||||
| 		return (out); | 		goto out; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* Check for standard or control key. */ | 	/* Check for standard or control key. */ | ||||||
| @@ -375,9 +378,25 @@ key_string_lookup_key(key_code key) | |||||||
| 		xsnprintf(tmp, sizeof tmp, "\\%llo", key); | 		xsnprintf(tmp, sizeof tmp, "\\%llo", key); | ||||||
|  |  | ||||||
| 	strlcat(out, tmp, sizeof out); | 	strlcat(out, tmp, sizeof out); | ||||||
| 	return (out); | 	goto out; | ||||||
|  |  | ||||||
| append: | append: | ||||||
| 	strlcat(out, s, sizeof out); | 	strlcat(out, s, sizeof out); | ||||||
|  |  | ||||||
|  | out: | ||||||
|  | 	if (with_flags && (saved & KEYC_MASK_FLAGS) != 0) { | ||||||
|  | 		strlcat(out, "[", sizeof out); | ||||||
|  | 		if (saved & KEYC_LITERAL) | ||||||
|  | 			strlcat(out, "L", sizeof out); | ||||||
|  | 		if (saved & KEYC_KEYPAD) | ||||||
|  | 			strlcat(out, "K", sizeof out); | ||||||
|  | 		if (saved & KEYC_CURSOR) | ||||||
|  | 			strlcat(out, "C", sizeof out); | ||||||
|  | 		if (saved & KEYC_IMPLIED_META) | ||||||
|  | 			strlcat(out, "I", sizeof out); | ||||||
|  | 		if (saved & KEYC_BUILD_MODIFIERS) | ||||||
|  | 			strlcat(out, "B", sizeof out); | ||||||
|  | 		strlcat(out, "]", sizeof out); | ||||||
|  | 	} | ||||||
| 	return (out); | 	return (out); | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								menu.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								menu.c
									
									
									
									
									
								
							| @@ -81,7 +81,7 @@ menu_add_item(struct menu *menu, const struct menu_item *item, | |||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	if (*s != '-' && item->key != KEYC_UNKNOWN && item->key != KEYC_NONE) { | 	if (*s != '-' && item->key != KEYC_UNKNOWN && item->key != KEYC_NONE) { | ||||||
| 		key = key_string_lookup_key(item->key); | 		key = key_string_lookup_key(item->key, 0); | ||||||
| 		xasprintf(&name, "%s#[default] #[align=right](%s)", s, key); | 		xasprintf(&name, "%s#[default] #[align=right](%s)", s, key); | ||||||
| 	} else | 	} else | ||||||
| 		xasprintf(&name, "%s", s); | 		xasprintf(&name, "%s", s); | ||||||
| @@ -226,7 +226,7 @@ menu_key_cb(struct client *c, struct key_event *event) | |||||||
| 			goto chosen; | 			goto chosen; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	switch (event->key) { | 	switch (event->key & ~KEYC_MASK_FLAGS) { | ||||||
| 	case KEYC_UP: | 	case KEYC_UP: | ||||||
| 	case 'k': | 	case 'k': | ||||||
| 		if (old == -1) | 		if (old == -1) | ||||||
|   | |||||||
| @@ -987,7 +987,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key, | |||||||
| 	choice = -1; | 	choice = -1; | ||||||
| 	if (*key >= '0' && *key <= '9') | 	if (*key >= '0' && *key <= '9') | ||||||
| 		choice = (*key) - '0'; | 		choice = (*key) - '0'; | ||||||
| 	else if (((*key) & KEYC_MASK_MOD) == KEYC_ESCAPE) { | 	else if (((*key) & KEYC_MASK_MODIFIERS) == KEYC_META) { | ||||||
| 		tmp = (*key) & KEYC_MASK_KEY; | 		tmp = (*key) & KEYC_MASK_KEY; | ||||||
| 		if (tmp >= 'a' && tmp <= 'z') | 		if (tmp >= 'a' && tmp <= 'z') | ||||||
| 			choice = 10 + (tmp - 'a'); | 			choice = 10 + (tmp - 'a'); | ||||||
| @@ -1111,12 +1111,12 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key, | |||||||
| 			mode_tree_build(mtd); | 			mode_tree_build(mtd); | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
| 	case '-'|KEYC_ESCAPE: | 	case '-'|KEYC_META: | ||||||
| 		TAILQ_FOREACH(mti, &mtd->children, entry) | 		TAILQ_FOREACH(mti, &mtd->children, entry) | ||||||
| 			mti->expanded = 0; | 			mti->expanded = 0; | ||||||
| 		mode_tree_build(mtd); | 		mode_tree_build(mtd); | ||||||
| 		break; | 		break; | ||||||
| 	case '+'|KEYC_ESCAPE: | 	case '+'|KEYC_META: | ||||||
| 		TAILQ_FOREACH(mti, &mtd->children, entry) | 		TAILQ_FOREACH(mti, &mtd->children, entry) | ||||||
| 			mti->expanded = 1; | 			mti->expanded = 1; | ||||||
| 		mode_tree_build(mtd); | 		mode_tree_build(mtd); | ||||||
|   | |||||||
| @@ -130,7 +130,7 @@ options_value_to_string(struct options_entry *o, union options_value *ov, | |||||||
| 			xasprintf(&s, "%lld", ov->number); | 			xasprintf(&s, "%lld", ov->number); | ||||||
| 			break; | 			break; | ||||||
| 		case OPTIONS_TABLE_KEY: | 		case OPTIONS_TABLE_KEY: | ||||||
| 			s = xstrdup(key_string_lookup_key(ov->number)); | 			s = xstrdup(key_string_lookup_key(ov->number, 0)); | ||||||
| 			break; | 			break; | ||||||
| 		case OPTIONS_TABLE_COLOUR: | 		case OPTIONS_TABLE_COLOUR: | ||||||
| 			s = xstrdup(colour_tostring(ov->number)); | 			s = xstrdup(colour_tostring(ov->number)); | ||||||
| @@ -283,7 +283,7 @@ options_default_to_string(const struct options_table_entry *oe) | |||||||
| 		xasprintf(&s, "%lld", oe->default_num); | 		xasprintf(&s, "%lld", oe->default_num); | ||||||
| 		break; | 		break; | ||||||
| 	case OPTIONS_TABLE_KEY: | 	case OPTIONS_TABLE_KEY: | ||||||
| 		s = xstrdup(key_string_lookup_key(oe->default_num)); | 		s = xstrdup(key_string_lookup_key(oe->default_num, 0)); | ||||||
| 		break; | 		break; | ||||||
| 	case OPTIONS_TABLE_COLOUR: | 	case OPTIONS_TABLE_COLOUR: | ||||||
| 		s = xstrdup(colour_tostring(oe->default_num)); | 		s = xstrdup(colour_tostring(oe->default_num)); | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								popup.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								popup.c
									
									
									
									
									
								
							| @@ -329,7 +329,7 @@ popup_key_cb(struct client *c, struct key_event *event) | |||||||
| 			bufferevent_write(job_get_event(pd->job), buf, len); | 			bufferevent_write(job_get_event(pd->job), buf, len); | ||||||
| 			return (0); | 			return (0); | ||||||
| 		} | 		} | ||||||
| 		input_key(NULL, &pd->s, job_get_event(pd->job), event->key); | 		input_key(&pd->s, job_get_event(pd->job), event->key); | ||||||
| 		return (0); | 		return (0); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -341,7 +341,7 @@ popup_key_cb(struct client *c, struct key_event *event) | |||||||
| 		format_defaults(ft, c, fs->s, fs->wl, fs->wp); | 		format_defaults(ft, c, fs->s, fs->wl, fs->wp); | ||||||
| 	else | 	else | ||||||
| 		format_defaults(ft, c, NULL, NULL, NULL); | 		format_defaults(ft, c, NULL, NULL, NULL); | ||||||
| 	format_add(ft, "popup_key", "%s", key_string_lookup_key(event->key)); | 	format_add(ft, "popup_key", "%s", key_string_lookup_key(event->key, 0)); | ||||||
| 	if (KEYC_IS_MOUSE(event->key)) { | 	if (KEYC_IS_MOUSE(event->key)) { | ||||||
| 		format_add(ft, "popup_mouse", "1"); | 		format_add(ft, "popup_mouse", "1"); | ||||||
| 		format_add(ft, "popup_mouse_x", "%u", m->x - pd->px); | 		format_add(ft, "popup_mouse_x", "%u", m->x - pd->px); | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								status.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								status.c
									
									
									
									
									
								
							| @@ -827,7 +827,7 @@ status_prompt_translate_key(struct client *c, key_code key, key_code *new_key) | |||||||
| 		return (1); | 		return (1); | ||||||
| 	case 'b': | 	case 'b': | ||||||
| 	case 'B': | 	case 'B': | ||||||
| 		*new_key = 'b'|KEYC_ESCAPE; | 		*new_key = 'b'|KEYC_META; | ||||||
| 		return (1); | 		return (1); | ||||||
| 	case 'd': | 	case 'd': | ||||||
| 		*new_key = '\025'; | 		*new_key = '\025'; | ||||||
| @@ -836,7 +836,7 @@ status_prompt_translate_key(struct client *c, key_code key, key_code *new_key) | |||||||
| 	case 'E': | 	case 'E': | ||||||
| 	case 'w': | 	case 'w': | ||||||
| 	case 'W': | 	case 'W': | ||||||
| 		*new_key = 'f'|KEYC_ESCAPE; | 		*new_key = 'f'|KEYC_META; | ||||||
| 		return (1); | 		return (1); | ||||||
| 	case 'p': | 	case 'p': | ||||||
| 		*new_key = '\031'; /* C-y */ | 		*new_key = '\031'; /* C-y */ | ||||||
| @@ -1023,7 +1023,7 @@ status_prompt_key(struct client *c, key_code key) | |||||||
| 	int			 keys; | 	int			 keys; | ||||||
|  |  | ||||||
| 	if (c->prompt_flags & PROMPT_KEY) { | 	if (c->prompt_flags & PROMPT_KEY) { | ||||||
| 		keystring = key_string_lookup_key(key); | 		keystring = key_string_lookup_key(key, 0); | ||||||
| 		c->prompt_inputcb(c, c->prompt_data, keystring, 1); | 		c->prompt_inputcb(c, c->prompt_data, keystring, 1); | ||||||
| 		status_prompt_clear(c); | 		status_prompt_clear(c); | ||||||
| 		return (0); | 		return (0); | ||||||
| @@ -1039,7 +1039,7 @@ status_prompt_key(struct client *c, key_code key) | |||||||
| 		free(s); | 		free(s); | ||||||
| 		return (1); | 		return (1); | ||||||
| 	} | 	} | ||||||
| 	key &= ~KEYC_XTERM; | 	key &= ~KEYC_MASK_FLAGS; | ||||||
|  |  | ||||||
| 	keys = options_get_number(c->session->options, "status-keys"); | 	keys = options_get_number(c->session->options, "status-keys"); | ||||||
| 	if (keys == MODEKEY_VI) { | 	if (keys == MODEKEY_VI) { | ||||||
| @@ -1158,7 +1158,7 @@ process_key: | |||||||
| 		c->prompt_index = idx; | 		c->prompt_index = idx; | ||||||
|  |  | ||||||
| 		goto changed; | 		goto changed; | ||||||
| 	case 'f'|KEYC_ESCAPE: | 	case 'f'|KEYC_META: | ||||||
| 	case KEYC_RIGHT|KEYC_CTRL: | 	case KEYC_RIGHT|KEYC_CTRL: | ||||||
| 		ws = options_get_string(oo, "word-separators"); | 		ws = options_get_string(oo, "word-separators"); | ||||||
|  |  | ||||||
| @@ -1182,7 +1182,7 @@ process_key: | |||||||
| 			c->prompt_index--; | 			c->prompt_index--; | ||||||
|  |  | ||||||
| 		goto changed; | 		goto changed; | ||||||
| 	case 'b'|KEYC_ESCAPE: | 	case 'b'|KEYC_META: | ||||||
| 	case KEYC_LEFT|KEYC_CTRL: | 	case KEYC_LEFT|KEYC_CTRL: | ||||||
| 		ws = options_get_string(oo, "word-separators"); | 		ws = options_get_string(oo, "word-separators"); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -460,7 +460,7 @@ window_customize_build_keys(struct window_customize_modedata *data, | |||||||
|  |  | ||||||
| 	bd = key_bindings_first(kt); | 	bd = key_bindings_first(kt); | ||||||
| 	while (bd != NULL) { | 	while (bd != NULL) { | ||||||
| 		format_add(ft, "key", "%s", key_string_lookup_key(bd->key)); | 		format_add(ft, "key", "%s", key_string_lookup_key(bd->key, 0)); | ||||||
| 		if (bd->note != NULL) | 		if (bd->note != NULL) | ||||||
| 			format_add(ft, "key_note", "%s", bd->note); | 			format_add(ft, "key_note", "%s", bd->note); | ||||||
| 		if (filter != NULL) { | 		if (filter != NULL) { | ||||||
| @@ -1233,7 +1233,7 @@ window_customize_set_key(struct client *c, | |||||||
| 	if (strcmp(s, "Repeat") == 0) | 	if (strcmp(s, "Repeat") == 0) | ||||||
| 		bd->flags ^= KEY_BINDING_REPEAT; | 		bd->flags ^= KEY_BINDING_REPEAT; | ||||||
| 	else if (strcmp(s, "Command") == 0) { | 	else if (strcmp(s, "Command") == 0) { | ||||||
| 		xasprintf(&prompt, "(%s) ", key_string_lookup_key(key)); | 		xasprintf(&prompt, "(%s) ", key_string_lookup_key(key, 0)); | ||||||
| 		value = cmd_list_print(bd->cmdlist, 0); | 		value = cmd_list_print(bd->cmdlist, 0); | ||||||
|  |  | ||||||
| 		new_item = xcalloc(1, sizeof *new_item); | 		new_item = xcalloc(1, sizeof *new_item); | ||||||
| @@ -1250,7 +1250,7 @@ window_customize_set_key(struct client *c, | |||||||
| 		free(prompt); | 		free(prompt); | ||||||
| 		free(value); | 		free(value); | ||||||
| 	} else if (strcmp(s, "Note") == 0) { | 	} else if (strcmp(s, "Note") == 0) { | ||||||
| 		xasprintf(&prompt, "(%s) ", key_string_lookup_key(key)); | 		xasprintf(&prompt, "(%s) ", key_string_lookup_key(key, 0)); | ||||||
|  |  | ||||||
| 		new_item = xcalloc(1, sizeof *new_item); | 		new_item = xcalloc(1, sizeof *new_item); | ||||||
| 		new_item->data = data; | 		new_item->data = data; | ||||||
| @@ -1395,7 +1395,7 @@ window_customize_key(struct window_mode_entry *wme, struct client *c, | |||||||
| 			break; | 			break; | ||||||
| 		if (item->scope == WINDOW_CUSTOMIZE_KEY) { | 		if (item->scope == WINDOW_CUSTOMIZE_KEY) { | ||||||
| 			xasprintf(&prompt, "Unbind key %s? ", | 			xasprintf(&prompt, "Unbind key %s? ", | ||||||
| 			    key_string_lookup_key(item->key)); | 			    key_string_lookup_key(item->key, 0)); | ||||||
| 		} else | 		} else | ||||||
| 			xasprintf(&prompt, "Unset option %s? ", item->name); | 			xasprintf(&prompt, "Unset option %s? ", item->name); | ||||||
| 		data->references++; | 		data->references++; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 nicm
					nicm