summaryrefslogtreecommitdiff
path: root/dmenu.c.orig
diff options
context:
space:
mode:
Diffstat (limited to 'dmenu.c.orig')
-rw-r--r--dmenu.c.orig44
1 files changed, 44 insertions, 0 deletions
diff --git a/dmenu.c.orig b/dmenu.c.orig
index 69a5e07..0757615 100644
--- a/dmenu.c.orig
+++ b/dmenu.c.orig
@@ -377,6 +377,8 @@ keypress(XKeyEvent *ev)
int len;
KeySym ksym;
Status status;
+ int i, offscreen = 0;
+ struct item *tmpsel;
len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
switch (status) {
@@ -503,6 +505,27 @@ 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) {
+ if (offscreen)
+ break;
+ return;
+ }
+ if (tmpsel == curr)
+ offscreen = 1;
+ tmpsel = tmpsel->left;
+ }
+ sel = tmpsel;
+ if (offscreen) {
+ curr = prev;
+ calcoffsets();
+ }
+ break;
+ }
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
cursor = nextrune(-1);
break;
@@ -539,6 +562,27 @@ 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) {
+ if (offscreen)
+ break;
+ return;
+ }
+ tmpsel = tmpsel->right;
+ if (tmpsel == next)
+ offscreen = 1;
+ }
+ sel = tmpsel;
+ if (offscreen) {
+ curr = next;
+ calcoffsets();
+ }
+ break;
+ }
if (text[cursor] != '\0') {
cursor = nextrune(+1);
break;