dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit 70eb7c374ba7fb8ac2a4203438b53e576b67db8f
parent 9d24218efce0b89351bf8be7e185b3afde97e69e
Author: Ross Mohn <rpmohn@waxandwane.org>
Date:   Mon, 18 Apr 2011 09:19:15 +0200

madtty: support the 8 basic highlighted colors

Plus a couple of color_hash fixes

Signed-off-by: Marc Andre Tanner <mat@brain-dump.org>

Diffstat:
madtty.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/madtty.c b/madtty.c @@ -55,7 +55,7 @@ static int has_default, is_utf8, use_palette; static const unsigned palette_start = 1; -static const unsigned palette_end = 256; +static const unsigned palette_end = 512; static unsigned palette_cur; static short *color2palette; @@ -417,6 +417,12 @@ static void interpret_csi_SGR(madtty_t *t, int param[], int pcount) case 49: t->curbg = -1; break; + case 90 ... 97: /* hi fg */ + t->curfg = param[i] - 82; + break; + case 100 ... 107: /* hi bg */ + t->curbg = param[i] - 92; + break; default: break; } @@ -1439,7 +1445,7 @@ void madtty_mouse(madtty_t *t, int x, int y, mmask_t mask) static unsigned color_hash(short f, short b) { - return ((f+1) * (COLORS+1)) + b + 1; + return ((f+1) * COLORS) + b + 1; } void madtty_color_set(WINDOW *win, short fg, short bg) @@ -1488,8 +1494,8 @@ void madtty_init_colors(void) color2palette = calloc((COLORS+1)*(COLORS+1), sizeof(short)); int bg = 0, fg = 0; for (int i = palette_start; i < palette_end; i++) { - init_pair(i, bg, fg); - color2palette[color_hash(bg, fg)] = i; + init_pair(i, fg, bg); + color2palette[color_hash(fg, bg)] = i; if (++fg == COLORS) { fg = 0; bg++;