summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2013-09-19 17:47:28 +0200
committerSven Eden <yamakuzure@gmx.net>2013-09-19 17:47:28 +0200
commitdd63f08b4cbc0f46e2a8b78e30d631b1032f0361 (patch)
tree01aebaf8a54456cc290ae11310c723da91c5bec9
parentcalculateDescWrap() is no aware of the brackets that are drawn around the pac... (diff)
downloadufed-dd63f08b4cbc0f46e2a8b78e30d631b1032f0361.tar.gz
ufed-dd63f08b4cbc0f46e2a8b78e30d631b1032f0361.tar.bz2
ufed-dd63f08b4cbc0f46e2a8b78e30d631b1032f0361.zip
calculateDescWrap() Fix offset of second part, this must be aware of the leading space and the surrounding brackets around the package list, too.
-rw-r--r--ufed-curses-checklist.c4
-rw-r--r--ufed-curses-types.c8
2 files changed, 6 insertions, 6 deletions
diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 9dff8e2..b77a6f7 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;
+ leftover = rightwidth - (int)length - (newDesc ? 0 : 2) - 1;
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, "%-*.*s", leftover, leftover, " ");
+ sprintf(pBuf + length, "%-*sX", leftover, " ");
/* Set correct color set according to highlighting and status*/
if(highlight)
diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 14c9313..71d751a 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -304,7 +304,7 @@ int getFlagHeight (const sFlag* flag)
int result = 0;
if (flag) {
- size_t maxLen = wWidth(List) - (minwidth + 8);;
+ size_t maxLen = wWidth(List) - (minwidth + 8);
for (int i = 0; i < flag->ndesc; ++i) {
if (isDescLegal(flag, i)) {
if (eWrap_normal == e_wrap)
@@ -575,7 +575,7 @@ static void calculateDescWrap(sDesc* desc)
end = wLen - 1;
// Step 2: Find last space character before end+1
- if ((end > start) && (' ' != pch[end])) {
+ if ((end > start) && (end < (wLen - 1)) && (' ' != pch[end])) {
size_t newEnd = end;
for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
if (newEnd > start)
@@ -611,12 +611,12 @@ static void calculateDescWrap(sDesc* desc)
// Switch from pkg to desc
pch = pDesc;
wLen = dLen;
- oLen = pLen + 2;
+ oLen = pLen + 3; // +2 for the brackets, + 1 for leading space
} else {
// Switch from desc to pkg
pch = pPkg;
wLen = pLen;
- oLen = dLen + 2;
+ oLen = dLen + 1; // +1 for leading space
}
start = 0;
} // End of having to swap pkg/desc