summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2013-09-12 08:40:51 +0200
committerSven Eden <yamakuzure@gmx.net>2013-09-12 08:40:51 +0200
commitf31544fa2ba397287162fadbb2bcae06e886f0dd (patch)
treecba560e64e7b5ae49ee75329a217c0e5ac1b7514
parentUpdated the fix for bug #478318 - It is more reliable now. (diff)
downloadufed-f31544fa2ba397287162fadbb2bcae06e886f0dd.tar.gz
ufed-f31544fa2ba397287162fadbb2bcae06e886f0dd.tar.bz2
ufed-f31544fa2ba397287162fadbb2bcae06e886f0dd.zip
types: Add a display length member to struct sKey and add a prototype for a function to set it.
-rw-r--r--ufed-curses-types.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index 450d6a3..e53a58c 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -159,6 +159,7 @@ typedef struct sKey_ {
size_t name_len; //!< length of the name
const char *desc[3]; //!< Help text to display, index is the relevant enum
size_t desc_len; //!< length of the (longest) description
+ size_t disp_len; //!< length that is available for display (space on screen)
int *idx; //!< index of descr to currently show (points to the relevant enum)
int row; //!< On which row this key is to be displayed, 0 or 1
} sKey;
@@ -168,9 +169,10 @@ extern int IDX_NULL_SENTRY;
#define MAKE_KEY(key, name, d1, d2, d3, idx, row) { \
key, \
name, \
- sizeof(name), \
+ strlen(name), \
{ d1, d2, d3 }, \
- max(max(sizeof(d1), sizeof(d2)), sizeof(d3)), \
+ /* Note: do not use strlen, the final 0-byte must be counted! */ \
+ max(max(sizeof(d1), sizeof(d2)), sizeof(d3)), 0, \
NULL != (idx) ? idx : &IDX_NULL_SENTRY, \
row \
}
@@ -198,5 +200,6 @@ bool isDescForced (const sFlag* flag, int idx);
bool isDescLegal (const sFlag* flag, int idx);
bool isDescMasked (const sFlag* flag, int idx);
bool isFlagLegal (const sFlag* flag);
+void setKeyDispLen(sKey* keys, size_t dispWidth);
#endif /* UFED_TYPES_H_INCLUDED */