dvtm

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

commit 85247a8819a844ab74cf0fc44e7c4e89ce4dc363
parent 57bcbcec733a476c1a61cb96ac4533ff35d4ea9c
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue,  7 Oct 2014 11:35:55 +0200

Fix color reservation bug

The reserved color index should only be incremented once the
allocation was successful.

Diffstat:
vt.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vt.c b/vt.c @@ -2364,8 +2364,8 @@ short vt_color_reserve(short fg, short bg) return 0; unsigned int index = color_hash(fg, bg); if (color2palette[index] >= 0) { - if (init_pair(++color_pairs_reserved, fg, bg) == OK) - color2palette[index] = -color_pairs_reserved; + if (init_pair(color_pairs_reserved + 1, fg, bg) == OK) + color2palette[index] = -(++color_pairs_reserved); } short color_pair = color2palette[index]; return color_pair >= 0 ? color_pair : -color_pair;