mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Merge branch 'obsd-master'
This commit is contained in:
		
							
								
								
									
										18
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								format.c
									
									
									
									
									
								
							@@ -4606,7 +4606,7 @@ format_expand1(struct format_expand_state *es, const char *fmt)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct format_tree	*ft = es->ft;
 | 
						struct format_tree	*ft = es->ft;
 | 
				
			||||||
	char			*buf, *out, *name;
 | 
						char			*buf, *out, *name;
 | 
				
			||||||
	const char		*ptr, *s;
 | 
						const char		*ptr, *s, *style_end = NULL;
 | 
				
			||||||
	size_t			 off, len, n, outlen;
 | 
						size_t			 off, len, n, outlen;
 | 
				
			||||||
	int     		 ch, brackets;
 | 
						int     		 ch, brackets;
 | 
				
			||||||
	char			 expanded[8192];
 | 
						char			 expanded[8192];
 | 
				
			||||||
@@ -4701,18 +4701,20 @@ format_expand1(struct format_expand_state *es, const char *fmt)
 | 
				
			|||||||
				break;
 | 
									break;
 | 
				
			||||||
			fmt += n + 1;
 | 
								fmt += n + 1;
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
							case '[':
 | 
				
			||||||
		case '#':
 | 
							case '#':
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * If ##[ (with two or more #s), then it is a style and
 | 
								 * If ##[ (with two or more #s), then it is a style and
 | 
				
			||||||
			 * can be left for format_draw to handle.
 | 
								 * can be left for format_draw to handle.
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			ptr = fmt;
 | 
								ptr = fmt - (ch == '[');
 | 
				
			||||||
			n = 2;
 | 
								n = 2 - (ch == '[');
 | 
				
			||||||
			while (*ptr == '#') {
 | 
								while (*ptr == '#') {
 | 
				
			||||||
				ptr++;
 | 
									ptr++;
 | 
				
			||||||
				n++;
 | 
									n++;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (*ptr == '[') {
 | 
								if (*ptr == '[') {
 | 
				
			||||||
 | 
									style_end = format_skip(fmt - 2, "]");
 | 
				
			||||||
				format_log(es, "found #*%zu[", n);
 | 
									format_log(es, "found #*%zu[", n);
 | 
				
			||||||
				while (len - off < n + 2) {
 | 
									while (len - off < n + 2) {
 | 
				
			||||||
					buf = xreallocarray(buf, 2, len);
 | 
										buf = xreallocarray(buf, 2, len);
 | 
				
			||||||
@@ -4735,10 +4737,12 @@ format_expand1(struct format_expand_state *es, const char *fmt)
 | 
				
			|||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			s = NULL;
 | 
								s = NULL;
 | 
				
			||||||
			if (ch >= 'A' && ch <= 'Z')
 | 
								if (fmt > style_end) { /* skip inside #[] */
 | 
				
			||||||
				s = format_upper[ch - 'A'];
 | 
									if (ch >= 'A' && ch <= 'Z')
 | 
				
			||||||
			else if (ch >= 'a' && ch <= 'z')
 | 
										s = format_upper[ch - 'A'];
 | 
				
			||||||
				s = format_lower[ch - 'a'];
 | 
									else if (ch >= 'a' && ch <= 'z')
 | 
				
			||||||
 | 
										s = format_lower[ch - 'a'];
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			if (s == NULL) {
 | 
								if (s == NULL) {
 | 
				
			||||||
				while (len - off < 3) {
 | 
									while (len - off < 3) {
 | 
				
			||||||
					buf = xreallocarray(buf, 2, len);
 | 
										buf = xreallocarray(buf, 2, len);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user