commit - 500ca6c142bd9cac546b494b19e17f54606ab88e
commit + 42a3658475b29186b22dd2596ea00233f383e613
blob - fe7184cb181e688024a52774cf3b4d0ac839ec94
blob + f1266ec0f555ccc479d52c0dab76b548f7e657a0
--- mymenu.c
+++ mymenu.c
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
-// modulo operator
-#define mod(a, b) (a < 0 ? (a % b + b) : (a % b))
-
// If we don't have it or we don't want an "ignore case" completion
// style, fall back to `strstr(3)`
#ifndef USE_STRCASESTR
if (index == -1 && p)
index = 0;
- index = cs->selected = mod((p ? index - 1 : index + 1), cs->lenght);
+ index = cs->selected = (cs->lenght + (p ? index - 1 : index + 1)) % cs->lenght;
struct completion *n = cs->completions;