sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dmenu-gridnav-5.2.diff (1445B)


      1 diff --git a/dmenu.c b/dmenu.c
      2 index 027dddb..0b92f1f 100644
      3 --- a/dmenu.c
      4 +++ b/dmenu.c
      5 @@ -334,6 +334,8 @@ keypress(XKeyEvent *ev)
      6  	int len;
      7  	KeySym ksym = NoSymbol;
      8  	Status status;
      9 +	int i, offscreen = 0;
     10 +	struct item *tmpsel;
     11  
     12  	len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
     13  	switch (status) {
     14 @@ -465,6 +467,27 @@ insert:
     15  		calcoffsets();
     16  		break;
     17  	case XK_Left:
     18 +		if (columns > 1) {
     19 +			if (!sel)
     20 +				return;
     21 +			tmpsel = sel;
     22 +			for (i = 0; i < lines; i++) {
     23 +				if (!tmpsel->left || tmpsel->left->right != tmpsel) {
     24 +					if (offscreen)
     25 +						break;
     26 +					return;
     27 +				}
     28 +				if (tmpsel == curr)
     29 +					offscreen = 1;
     30 +				tmpsel = tmpsel->left;
     31 +			}
     32 +			sel = tmpsel;
     33 +			if (offscreen) {
     34 +				curr = prev;
     35 +				calcoffsets();
     36 +			}
     37 +			break;
     38 +		}
     39  	case XK_KP_Left:
     40  		if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
     41  			cursor = nextrune(-1);
     42 @@ -505,6 +528,27 @@ insert:
     43  			sel->out = 1;
     44  		break;
     45  	case XK_Right:
     46 +		if (columns > 1) {
     47 +			if (!sel)
     48 +				return;
     49 +			tmpsel = sel;
     50 +			for (i = 0; i < lines; i++) {
     51 +				if (!tmpsel->right ||  tmpsel->right->left != tmpsel) {
     52 +					if (offscreen)
     53 +						break;
     54 +					return;
     55 +				}
     56 +				tmpsel = tmpsel->right;
     57 +				if (tmpsel == next)
     58 +					offscreen = 1;
     59 +			}
     60 +			sel = tmpsel;
     61 +			if (offscreen) {
     62 +				curr = next;
     63 +				calcoffsets();
     64 +			}
     65 +			break;
     66 +		}
     67  	case XK_KP_Right:
     68  		if (text[cursor] != '\0') {
     69  			cursor = nextrune(+1);