mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 09:26:05 +00:00 
			
		
		
		
	Collect strings correctly when on terminals that don't support UTF-8.
This commit is contained in:
		
							
								
								
									
										21
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								tty.c
									
									
									
									
									
								
							@@ -709,7 +709,11 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
 | 
			
		||||
	for (i = 0; i < sx; i++) {
 | 
			
		||||
		grid_view_get_cell(s->grid, i, py, &gc);
 | 
			
		||||
		if (len != 0 &&
 | 
			
		||||
		    (gc.attr & GRID_ATTR_CHARSET ||
 | 
			
		||||
		    (((~tty->flags & TTY_UTF8) &&
 | 
			
		||||
		    (gc.data.size != 1 ||
 | 
			
		||||
		    *gc.data.data >= 0x7f ||
 | 
			
		||||
		    gc.data.width != 1)) ||
 | 
			
		||||
		    (gc.attr & GRID_ATTR_CHARSET) ||
 | 
			
		||||
		    gc.flags != last.flags ||
 | 
			
		||||
		    gc.attr != last.attr ||
 | 
			
		||||
		    gc.fg != last.fg ||
 | 
			
		||||
@@ -726,10 +730,19 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
 | 
			
		||||
			screen_select_cell(s, &last, &gc);
 | 
			
		||||
		else
 | 
			
		||||
			memcpy(&last, &gc, sizeof last);
 | 
			
		||||
		if (gc.attr & GRID_ATTR_CHARSET) {
 | 
			
		||||
		if (((~tty->flags & TTY_UTF8) &&
 | 
			
		||||
		    (gc.data.size != 1 ||
 | 
			
		||||
		    *gc.data.data >= 0x7f ||
 | 
			
		||||
		    gc.data.width != 1)) ||
 | 
			
		||||
		    (gc.attr & GRID_ATTR_CHARSET)) {
 | 
			
		||||
			tty_attributes(tty, &last, wp);
 | 
			
		||||
			for (j = 0; j < gc.data.size; j++)
 | 
			
		||||
				tty_putc(tty, gc.data.data[j]);
 | 
			
		||||
			if (~tty->flags & TTY_UTF8) {
 | 
			
		||||
				for (j = 0; j < gc.data.width; j++)
 | 
			
		||||
					tty_putc(tty, '_');
 | 
			
		||||
			} else {
 | 
			
		||||
				for (j = 0; j < gc.data.size; j++)
 | 
			
		||||
					tty_putc(tty, gc.data.data[j]);
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			memcpy(buf + len, gc.data.data, gc.data.size);
 | 
			
		||||
			len += gc.data.size;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user