mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Don't map 256 to white-on-white either, and tidy code a bit.
This commit is contained in:
		
							
								
								
									
										42
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								tty.c
									
									
									
									
									
								
							@@ -2760,15 +2760,23 @@ tty_check_fg(struct tty *tty, struct colour_palette *palette,
 | 
				
			|||||||
	/* Is this a 256-colour colour? */
 | 
						/* Is this a 256-colour colour? */
 | 
				
			||||||
	if (gc->fg & COLOUR_FLAG_256) {
 | 
						if (gc->fg & COLOUR_FLAG_256) {
 | 
				
			||||||
		/* And not a 256 colour mode? */
 | 
							/* And not a 256 colour mode? */
 | 
				
			||||||
		if (colours < 256) {
 | 
							if (colours >= 256)
 | 
				
			||||||
			gc->fg = colour_256to16(gc->fg);
 | 
								return;
 | 
				
			||||||
			if (gc->fg & 8) {
 | 
							gc->fg = colour_256to16(gc->fg);
 | 
				
			||||||
				gc->fg &= 7;
 | 
							if (~gc->fg & 8)
 | 
				
			||||||
				if (colours >= 16)
 | 
								return;
 | 
				
			||||||
					gc->fg += 90;
 | 
							gc->fg &= 7;
 | 
				
			||||||
				else if (gc->fg == 0 && gc->bg == 0)
 | 
							if (colours >= 16)
 | 
				
			||||||
					gc->fg = 7;
 | 
								gc->fg += 90;
 | 
				
			||||||
			}
 | 
							else {
 | 
				
			||||||
 | 
								/*
 | 
				
			||||||
 | 
								 * Mapping to black-on-black or white-on-white is not
 | 
				
			||||||
 | 
								 * much use, so change the foreground.
 | 
				
			||||||
 | 
								 */
 | 
				
			||||||
 | 
								if (gc->fg == 0 && gc->bg == 0)
 | 
				
			||||||
 | 
									gc->fg = 7;
 | 
				
			||||||
 | 
								else if (gc->fg == 7 && gc->bg == 7)
 | 
				
			||||||
 | 
									gc->fg = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -2816,14 +2824,14 @@ tty_check_bg(struct tty *tty, struct colour_palette *palette,
 | 
				
			|||||||
		 * palette. Bold background doesn't exist portably, so just
 | 
							 * palette. Bold background doesn't exist portably, so just
 | 
				
			||||||
		 * discard the bold bit if set.
 | 
							 * discard the bold bit if set.
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		if (colours < 256) {
 | 
							if (colours >= 256)
 | 
				
			||||||
			gc->bg = colour_256to16(gc->bg);
 | 
								return;
 | 
				
			||||||
			if (gc->bg & 8) {
 | 
							gc->bg = colour_256to16(gc->bg);
 | 
				
			||||||
				gc->bg &= 7;
 | 
							if (~gc->bg & 8)
 | 
				
			||||||
				if (colours >= 16)
 | 
								return;
 | 
				
			||||||
					gc->bg += 90;
 | 
							gc->bg &= 7;
 | 
				
			||||||
			}
 | 
							if (colours >= 16)
 | 
				
			||||||
		}
 | 
								gc->bg += 90;
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user