summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-28 08:33:21 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-28 08:33:21 +0000
commitb062c31e2aca793d9026661d2643d31fd44670af (patch)
tree72dc63032e4924167f2c6e5a9e646fc30e138b58
parent4863a0bd099edb8922c497d8cfd48ecb266093c0 (diff)
Twaek this slightly to avoid confusing use of flags variable.
-rw-r--r--usr.bin/tmux/tty.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 44ed04117b8..adb27046c77 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.61 2009/10/28 08:27:33 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.62 2009/10/28 08:33:20 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1179,14 +1179,13 @@ void
tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
{
struct grid_cell *tc = &tty->cell;
- u_char fg = gc->fg, bg = gc->bg;
- int flags, have_ax;
- int fg_default, bg_default;
+ u_char fg = gc->fg, bg = gc->bg, flags = gc->flags;
+ int have_ax, fg_default, bg_default;
/* No changes? Nothing is necessary. */
- flags = (gc->flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256);
- if (fg == tc->fg && bg == tc->bg && flags == 0)
- return;
+ if (fg == tc->fg && bg == tc->bg &&
+ ((flags ^ tc->flags) & (GRID_FLAG_FG256|GRID_FLAG_BG256)) == 0)
+ return;
/*
* Is either the default colour? This is handled specially because the
@@ -1194,8 +1193,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
* colour.
*/
- fg_default = (fg == 8 && !(gc->flags & GRID_FLAG_FG256));
- bg_default = (bg == 8 && !(gc->flags & GRID_FLAG_BG256));
+ fg_default = (fg == 8 && !(flags & GRID_FLAG_FG256));
+ bg_default = (bg == 8 && !(flags & GRID_FLAG_BG256));
if (fg_default || bg_default) {
/*
* If don't have AX but do have op, send sgr0 (op can't
@@ -1231,7 +1230,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
/* Set the foreground colour. */
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);
/*
@@ -1239,7 +1238,7 @@ tty_colours(struct tty *tty, const struct grid_cell *gc, int *attr)
* tty_colour_fg() can call tty_reset().
*/
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);
}