mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Show UTF-8 in choose-buffer mode. From KOIE Hidetaka.
This commit is contained in:
		@@ -208,9 +208,9 @@ window_buffer_draw(__unused void *modedata, void *itemdata,
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	struct window_buffer_itemdata	*item = itemdata;
 | 
						struct window_buffer_itemdata	*item = itemdata;
 | 
				
			||||||
	struct paste_buffer		*pb;
 | 
						struct paste_buffer		*pb;
 | 
				
			||||||
	char				 line[1024];
 | 
						const char			*pdata, *start, *end;
 | 
				
			||||||
	const char			*pdata, *end, *cp;
 | 
						char				*buf = NULL;
 | 
				
			||||||
	size_t				 psize, at;
 | 
						size_t				 psize, len;
 | 
				
			||||||
	u_int				 i, cx = ctx->s->cx, cy = ctx->s->cy;
 | 
						u_int				 i, cx = ctx->s->cx, cy = ctx->s->cy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pb = paste_get_name(item->name);
 | 
						pb = paste_get_name(item->name);
 | 
				
			||||||
@@ -219,27 +219,22 @@ window_buffer_draw(__unused void *modedata, void *itemdata,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	pdata = end = paste_buffer_data(pb, &psize);
 | 
						pdata = end = paste_buffer_data(pb, &psize);
 | 
				
			||||||
	for (i = 0; i < sy; i++) {
 | 
						for (i = 0; i < sy; i++) {
 | 
				
			||||||
		at = 0;
 | 
							start = end;
 | 
				
			||||||
		while (end != pdata + psize && *end != '\n') {
 | 
							while (end != pdata + psize && *end != '\n')
 | 
				
			||||||
			if ((sizeof line) - at > 5) {
 | 
					 | 
				
			||||||
				cp = vis(line + at, *end, VIS_OCTAL|VIS_TAB, 0);
 | 
					 | 
				
			||||||
				at = cp - line;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			end++;
 | 
								end++;
 | 
				
			||||||
		}
 | 
							buf = xreallocarray(buf, 4, end - start + 1);
 | 
				
			||||||
		if (at > sx)
 | 
							len = utf8_strvis(buf, start, end - start, VIS_OCTAL|VIS_TAB);
 | 
				
			||||||
			at = sx;
 | 
							if (*buf != '\0') {
 | 
				
			||||||
		line[at] = '\0';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (*line != '\0') {
 | 
					 | 
				
			||||||
			screen_write_cursormove(ctx, cx, cy + i, 0);
 | 
								screen_write_cursormove(ctx, cx, cy + i, 0);
 | 
				
			||||||
			screen_write_puts(ctx, &grid_default_cell, "%s", line);
 | 
								screen_write_nputs(ctx, sx, &grid_default_cell, "%s",
 | 
				
			||||||
 | 
								    buf);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (end == pdata + psize)
 | 
							if (end == pdata + psize)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		end++;
 | 
							end++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						free(buf);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user