diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-09-09 17:35:04 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-09-09 17:35:04 +0000 |
commit | 1e145a639be109f53381c64bd83483d32ffc8524 (patch) | |
tree | 053dee0ff47fd7c77bca1ccb243a15110f926a86 /input.c | |
parent | d4173e2a783fe5e3041d801bb49cca8bc6160eeb (diff) |
Unbreak 256 colours when commands are combined.
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.56 2008-09-08 22:03:54 nicm Exp $ */ +/* $Id: input.c,v 1.57 2008-09-09 17:35:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1061,35 +1061,35 @@ input_handle_sequence_sgr(struct input_ctx *ictx) bg = s->bg; n = ARRAY_LENGTH(&ictx->args); - switch (n) { - case 0: + if (n == 0) { attr = 0; fg = 8; bg = 8; - break; - case 3: - if (input_get_argument(ictx, 1, &m, 0) != 0) - return; - if (m == 5) { - if (input_get_argument(ictx, 0, &o, 0) != 0) - return; - if (input_get_argument(ictx, 2, &m, 0) != 0) - return; - if (o == 38) { - attr |= ATTR_FG256; - fg = m; - break; - } else if (o == 48) { - attr |= ATTR_BG256; - bg = m; - break; - } - } - /* FALLTHROUGH */ - default: + } else { for (i = 0; i < n; i++) { if (input_get_argument(ictx, i, &m, 0) != 0) return; + + if (m == 38 || m == 48) { + i++; + if (input_get_argument(ictx, i, &o, 0) != 0) + return; + if (o != 5) + continue; + + i++; + if (input_get_argument(ictx, i, &o, 0) != 0) + return; + if (m == 38) { + attr |= ATTR_FG256; + fg = o; + } else if (m == 48) { + attr |= ATTR_BG256; + bg = o; + } + continue; + } + switch (m) { case 0: case 10: |