diff options
author | Sven Eden <yamakuzure@gmx.net> | 2013-09-19 17:56:27 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2013-09-19 17:56:27 +0200 |
commit | 6c224bde4f19f22c5db934a62282315131ac8ce1 (patch) | |
tree | c6cfa9ce739564962ee5db81c3beb791008386c6 | |
parent | calculateDescWrap() Fix offset of second part, this must be aware of the lead... (diff) | |
download | ufed-6c224bde4f19f22c5db934a62282315131ac8ce1.tar.gz ufed-6c224bde4f19f22c5db934a62282315131ac8ce1.tar.bz2 ufed-6c224bde4f19f22c5db934a62282315131ac8ce1.zip |
drawflag(): Advancing the wrapped description part is put to the end of the loop, it is much safer there.
-rw-r--r-- | ufed-curses-checklist.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index b77a6f7..d457c1c 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -286,7 +286,7 @@ static int drawflag(sFlag* flag, bool highlight) setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length); // The right side of buf can be added now: - leftover = rightwidth - (int)length - (newDesc ? 0 : 2) - 1; + leftover = rightwidth - (int)length - (newDesc ? 0 : 2); pBuf = &buf[minwidth + (newDesc ? 8 : 10)]; sprintf(pBuf, "%-*.*s", (int)length, (int)length, @@ -295,7 +295,7 @@ static int drawflag(sFlag* flag, bool highlight) // Leftover characters on the right must be blanked: if (leftover > 0) - sprintf(pBuf + length, "%-*sX", leftover, " "); + sprintf(pBuf + length, "%-*s", leftover, " "); /* Set correct color set according to highlighting and status*/ if(highlight) @@ -353,11 +353,19 @@ static int drawflag(sFlag* flag, bool highlight) // Advance counters and possibly description index ++line; ++usedY; - if (NULL == wrapPart) { + + // When wrapping the wrapPart must be advanced and checked + if (eWrap_wrap == e_wrap) { + wrapPart = wrapPart ? wrapPart->next : NULL; + if (wrapPart) + newDesc = false; + else + newDesc = true; + } + + if (newDesc) ++idx; - newDesc = true; - } else - newDesc = false; + } // end of looping flag descriptions if(highlight) @@ -766,8 +774,6 @@ static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, s if (NULL == wrapPart) wrapPart = flag->desc[index].wrap; - else - wrapPart = wrapPart->next; // The length and position can be written back already if (wrapPart) { |