mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
numbers: update to fix segfault in some conditions
Ref. https://git.suckless.org/sites/commit/98926264b1507784b5e2af41890e26db0e28c1dd.html
This commit is contained in:
parent
872a3623d0
commit
5c1be5d667
14
dmenu.c
14
dmenu.c
@ -236,9 +236,9 @@ appenditem(struct item *item, struct item **list, struct item **last)
|
|||||||
static void
|
static void
|
||||||
calcoffsets(void)
|
calcoffsets(void)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n, rpad = 0;
|
||||||
|
|
||||||
if (lines > 0)
|
if (lines > 0) {
|
||||||
#if GRID_PATCH
|
#if GRID_PATCH
|
||||||
if (columns)
|
if (columns)
|
||||||
n = lines * columns * bh;
|
n = lines * columns * bh;
|
||||||
@ -247,12 +247,16 @@ calcoffsets(void)
|
|||||||
#else
|
#else
|
||||||
n = lines * bh;
|
n = lines * bh;
|
||||||
#endif // GRID_PATCH
|
#endif // GRID_PATCH
|
||||||
else
|
} else {
|
||||||
|
#if NUMBERS_PATCH
|
||||||
|
rpad = TEXTW(numbers);
|
||||||
|
#endif // NUMBERS_PATCH
|
||||||
#if SYMBOLS_PATCH
|
#if SYMBOLS_PATCH
|
||||||
n = mw - (promptw + inputw + TEXTW(symbol_1) + TEXTW(symbol_2));
|
n = mw - (promptw + inputw + TEXTW(symbol_1) + TEXTW(symbol_2) + rpad);
|
||||||
#else
|
#else
|
||||||
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">"));
|
n = mw - (promptw + inputw + TEXTW("<") + TEXTW(">") + rpad);
|
||||||
#endif // SYMBOLS_PATCH
|
#endif // SYMBOLS_PATCH
|
||||||
|
}
|
||||||
/* calculate which items will begin the next page and previous page */
|
/* calculate which items will begin the next page and previous page */
|
||||||
for (i = 0, next = curr; next; next = next->right)
|
for (i = 0, next = curr; next; next = next->right)
|
||||||
if ((i += (lines > 0) ? bh : textw_clamp(next->text, n)) > n)
|
if ((i += (lines > 0) ? bh : textw_clamp(next->text, n)) > n)
|
||||||
|
Loading…
Reference in New Issue
Block a user