mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	When a flag option is used in a format, it should use the number form
not string.
This commit is contained in:
		@@ -110,7 +110,7 @@ cmd_show_options_print(struct cmd *self, struct cmdq_item *item,
 | 
				
			|||||||
		name = options_name(o);
 | 
							name = options_name(o);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	value = options_tostring(o, idx);
 | 
						value = options_tostring(o, idx, 0);
 | 
				
			||||||
	if (args_has(self->args, 'v'))
 | 
						if (args_has(self->args, 'v'))
 | 
				
			||||||
		cmdq_print(item, "%s", value);
 | 
							cmdq_print(item, "%s", value);
 | 
				
			||||||
	else if (options_isstring(o)) {
 | 
						else if (options_isstring(o)) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								format.c
									
									
									
									
									
								
							@@ -638,7 +638,7 @@ format_find(struct format_tree *ft, const char *key, int modifiers)
 | 
				
			|||||||
		if (o == NULL)
 | 
							if (o == NULL)
 | 
				
			||||||
			o = options_parse_get(global_s_options, key, &idx, 0);
 | 
								o = options_parse_get(global_s_options, key, &idx, 0);
 | 
				
			||||||
		if (o != NULL) {
 | 
							if (o != NULL) {
 | 
				
			||||||
			found = options_tostring(o, idx);
 | 
								found = options_tostring(o, idx, 1);
 | 
				
			||||||
			goto found;
 | 
								goto found;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -325,7 +325,7 @@ options_isstring(struct options_entry *o)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *
 | 
					const char *
 | 
				
			||||||
options_tostring(struct options_entry *o, int idx)
 | 
					options_tostring(struct options_entry *o, int idx, int numeric)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static char	 s[1024];
 | 
						static char	 s[1024];
 | 
				
			||||||
	const char	*tmp;
 | 
						const char	*tmp;
 | 
				
			||||||
@@ -355,7 +355,10 @@ options_tostring(struct options_entry *o, int idx)
 | 
				
			|||||||
			tmp = attributes_tostring(o->number);
 | 
								tmp = attributes_tostring(o->number);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case OPTIONS_TABLE_FLAG:
 | 
							case OPTIONS_TABLE_FLAG:
 | 
				
			||||||
			tmp = (o->number ? "on" : "off");
 | 
								if (numeric)
 | 
				
			||||||
 | 
									xsnprintf(s, sizeof s, "%lld", o->number);
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									tmp = (o->number ? "on" : "off");
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case OPTIONS_TABLE_CHOICE:
 | 
							case OPTIONS_TABLE_CHOICE:
 | 
				
			||||||
			tmp = o->tableentry->choices[o->number];
 | 
								tmp = o->tableentry->choices[o->number];
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								tmux.h
									
									
									
									
									
								
							@@ -1562,7 +1562,7 @@ int		 options_array_set(struct options_entry *, u_int, const char *,
 | 
				
			|||||||
int		 options_array_size(struct options_entry *, u_int *);
 | 
					int		 options_array_size(struct options_entry *, u_int *);
 | 
				
			||||||
void		 options_array_assign(struct options_entry *, const char *);
 | 
					void		 options_array_assign(struct options_entry *, const char *);
 | 
				
			||||||
int		 options_isstring(struct options_entry *);
 | 
					int		 options_isstring(struct options_entry *);
 | 
				
			||||||
const char	*options_tostring(struct options_entry *, int);
 | 
					const char	*options_tostring(struct options_entry *, int, int);
 | 
				
			||||||
char		*options_parse(const char *, int *);
 | 
					char		*options_parse(const char *, int *);
 | 
				
			||||||
struct options_entry *options_parse_get(struct options *, const char *, int *,
 | 
					struct options_entry *options_parse_get(struct options *, const char *, int *,
 | 
				
			||||||
		     int);
 | 
							     int);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user