mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Sync OpenBSD patchset 470:
Twaek this slightly to avoid confusing use of flags variable.
This commit is contained in:
		
							
								
								
									
										21
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								tty.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: tty.c,v 1.165 2009-10-28 23:15:32 tcunha Exp $ */
 | 
					/* $Id: tty.c,v 1.166 2009-10-28 23:16:30 tcunha Exp $ */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
					 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
				
			||||||
@@ -1184,14 +1184,13 @@ void
 | 
				
			|||||||
tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
 | 
					tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct grid_cell	*tc = &tty->cell;
 | 
						struct grid_cell	*tc = &tty->cell;
 | 
				
			||||||
	u_char			 fg = gc->fg, bg = gc->bg;
 | 
						u_char			 fg = gc->fg, bg = gc->bg, flags = gc->flags;
 | 
				
			||||||
	int			 flags, have_ax;
 | 
						int			 have_ax, fg_default, bg_default;
 | 
				
			||||||
	int			 fg_default, bg_default;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* No changes? Nothing is necessary. */
 | 
						/* No changes? Nothing is necessary. */
 | 
				
			||||||
	flags = (gc->flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256);
 | 
						if (fg == tc->fg && bg == tc->bg &&
 | 
				
			||||||
	if (fg == tc->fg && bg == tc->bg && flags == 0)
 | 
						    ((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0)
 | 
				
			||||||
		return;
 | 
							return;  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Is either the default colour? This is handled specially because the
 | 
						 * Is either the default colour? This is handled specially because the
 | 
				
			||||||
@@ -1199,8 +1198,8 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
 | 
				
			|||||||
	 * case if only one is default need to fall onward to set the other
 | 
						 * case if only one is default need to fall onward to set the other
 | 
				
			||||||
	 * colour.
 | 
						 * colour.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	fg_default = (fg == 8 && !(gc->flags & GRID_FLAG_FG256));
 | 
						fg_default = (fg == 8 && !(flags & GRID_FLAG_FG256));
 | 
				
			||||||
	bg_default = (bg == 8 && !(gc->flags & GRID_FLAG_BG256));
 | 
						bg_default = (bg == 8 && !(flags & GRID_FLAG_BG256));
 | 
				
			||||||
	if (fg_default || bg_default) {
 | 
						if (fg_default || bg_default) {
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * If don't have AX but do have op, send sgr0 (op can't
 | 
							 * If don't have AX but do have op, send sgr0 (op can't
 | 
				
			||||||
@@ -1236,7 +1235,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	/* Set the foreground colour. */
 | 
						/* Set the foreground colour. */
 | 
				
			||||||
	if (!fg_default && (fg != tc->fg ||
 | 
						if (!fg_default && (fg != tc->fg ||
 | 
				
			||||||
	    ((gc->flags & GRID_FLAG_FG256) != (tc->flags & GRID_FLAG_FG256))))
 | 
						    ((flags & GRID_FLAG_FG256) != (tc->flags & GRID_FLAG_FG256))))
 | 
				
			||||||
		tty_colours_fg(tty, gc, attr);
 | 
							tty_colours_fg(tty, gc, attr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
@@ -1244,7 +1243,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
 | 
				
			|||||||
	 * tty_colour_fg() can call tty_reset().
 | 
						 * tty_colour_fg() can call tty_reset().
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (!bg_default && (bg != tc->bg ||
 | 
						if (!bg_default && (bg != tc->bg ||
 | 
				
			||||||
	    ((gc->flags & GRID_FLAG_BG256) != (tc->flags & GRID_FLAG_BG256))))
 | 
						    ((flags & GRID_FLAG_BG256) != (tc->flags & GRID_FLAG_BG256))))
 | 
				
			||||||
		tty_colours_bg(tty, gc, attr);
 | 
							tty_colours_bg(tty, gc, attr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user