commit 9fbc7a4c40cd7377f5183de675ed9c76e098970a
Author: zerg <[email protected]>
Date:   Thu Mar 30 21:14:36 2023 -0700

    [dmenu][patch][vi_mode] Forgot to add C-d and C-u movements

diff --git 
a/tools.suckless.org/dmenu/patches/vi-mode/dmenu-vi_mode-20230330-dfbbf7f.diff 
b/tools.suckless.org/dmenu/patches/vi-mode/dmenu-vi_mode-20230330-dfbbf7f.diff
index d23d0936..a1cb43c7 100644
--- 
a/tools.suckless.org/dmenu/patches/vi-mode/dmenu-vi_mode-20230330-dfbbf7f.diff
+++ 
b/tools.suckless.org/dmenu/patches/vi-mode/dmenu-vi_mode-20230330-dfbbf7f.diff
@@ -27,7 +27,7 @@ index 1edb647..7bf5f4a 100644
 +      { XK_q,         0 }
 +};
 diff --git a/dmenu.c b/dmenu.c
-index 4e7df12..902ad4e 100644
+index 4e7df12..14fbde3 100644
 --- a/dmenu.c
 +++ b/dmenu.c
 @@ -26,7 +26,7 @@
@@ -76,16 +76,33 @@ index 4e7df12..902ad4e 100644
                drw_setscheme(drw, scheme[SchemeNorm]);
                drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
        }
-@@ -321,6 +335,161 @@ movewordedge(int dir)
+@@ -321,6 +335,179 @@ movewordedge(int dir)
        }
  }
  
 +static void
-+vi_keypress(const KeySym ksym, const XKeyEvent *ev)
++vi_keypress(KeySym ksym, const XKeyEvent *ev)
 +{
 +      static const size_t quit_len = LENGTH(quit_keys);
 +      if (ev->state & ControlMask) {
 +              switch(ksym) {
++              /* movement */
++              case XK_d: /* fallthrough */
++                      if (next) {
++                              sel = curr = next;
++                              calcoffsets();
++                              goto draw;
++                      } else
++                              ksym = XK_G;
++                      break;
++              case XK_u:
++                      if (prev) {
++                              sel = curr = prev;
++                              calcoffsets();
++                              goto draw;
++                      } else
++                              ksym = XK_g;
++                      break;
 +              case XK_p: /* fallthrough */
 +              case XK_P: break;
 +              case XK_c:
@@ -232,13 +249,14 @@ index 4e7df12..902ad4e 100644
 +                      }
 +      }
 +
++draw:
 +      drawmenu();
 +}
 +
  static void
  keypress(XKeyEvent *ev)
  {
-@@ -340,6 +509,18 @@ keypress(XKeyEvent *ev)
+@@ -340,6 +527,18 @@ keypress(XKeyEvent *ev)
                break;
        }
  
@@ -257,7 +275,7 @@ index 4e7df12..902ad4e 100644
        if (ev->state & ControlMask) {
                switch(ksym) {
                case XK_a: ksym = XK_Home;      break;
-@@ -543,6 +724,8 @@ paste(void)
+@@ -543,6 +742,8 @@ paste(void)
                insert(p, (q = strchr(p, '
')) ? q - p : (ssize_t)strlen(p));
                XFree(p);
        }
@@ -266,7 +284,7 @@ index 4e7df12..902ad4e 100644
        drawmenu();
  }
  
-@@ -737,6 +920,11 @@ main(int argc, char *argv[])
+@@ -737,6 +938,11 @@ main(int argc, char *argv[])
                else if (!strcmp(argv[i], "-i")) { /* case-insensitive item 
matching */
                        fstrncmp = strncasecmp;
                        fstrstr = cistrstr;
diff --git a/tools.suckless.org/dmenu/patches/vi-mode/index.md 
b/tools.suckless.org/dmenu/patches/vi-mode/index.md
index 8780a2c2..ddb6d2c8 100644
--- a/tools.suckless.org/dmenu/patches/vi-mode/index.md
+++ b/tools.suckless.org/dmenu/patches/vi-mode/index.md
@@ -7,7 +7,7 @@ With this patch dmenu will have basic vi mode capabilities.
 Implemented actions
 -------------------
 * movements inside typed text with `[h|l|w|b|e|0|$]`
-* movements through list with `[j|k|g|G]`
+* movements through list with `[j|k|g|G|C-d|C-u]`
 * standard insertions with `[a|A|i|I]`
 * paste after|before cursor with `[p|P]`, use `ctrl` to use clipboard
 * delete from cursor to eol with `D`


Reply via email to