~smlavine/dmenu

99c5650be1592fe99a741e9e25f05b0ffb5ccbf9 — Sebastian LaVine 20 days ago 36d521f
Apply dmenu-gridnav-5.0.diff

https://tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff
1 files changed, 40 insertions(+), 0 deletions(-)

M dmenu.c
M dmenu.c => dmenu.c +40 -0
@@ 7,6 7,7 @@
#include <strings.h>
#include <time.h>
#include <unistd.h>
#include <stdbool.h>

#include <X11/Xlib.h>
#include <X11/Xatom.h>


@@ 395,6 396,9 @@ keypress(XKeyEvent *ev)
	int len;
	KeySym ksym;
	Status status;
	int i;
	struct item *tmpsel;
	bool offscreen = false;

	len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
	switch (status) {


@@ 521,6 525,24 @@ insert:
		calcoffsets();
		break;
	case XK_Left:
		if (columns > 1) {
			if (!sel)
				return;
			tmpsel = sel;
			for (i = 0; i < lines; i++) {
				if (!tmpsel->left ||  tmpsel->left->right != tmpsel)
					return;
				if (tmpsel == curr)
					offscreen = true;
				tmpsel = tmpsel->left;
			}
			sel = tmpsel;
			if (offscreen) {
				curr = prev;
				calcoffsets();
			}
			break;
		}
		if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
			cursor = nextrune(-1);
			break;


@@ 557,6 579,24 @@ insert:
			sel->out = 1;
		break;
	case XK_Right:
		if (columns > 1) {
			if (!sel)
				return;
			tmpsel = sel;
			for (i = 0; i < lines; i++) {
				if (!tmpsel->right ||  tmpsel->right->left != tmpsel)
					return;
				tmpsel = tmpsel->right;
				if (tmpsel == next)
					offscreen = true;
			}
			sel = tmpsel;
			if (offscreen) {
				curr = next;
				calcoffsets();
			}
			break;
		}
		if (text[cursor] != '\0') {
			cursor = nextrune(+1);
			break;