[wiki] [sites] [dmenu][patch][vi_mode] Forgot to add C-d and C-u movements || zerg
commit 9fbc7a4c40cd7377f5183de675ed9c76e098970a
Author: zerg <zergrusherncrusher_AT_disroot.org>
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
_AT_@ -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
_AT_@ -26,7 +26,7 @@
_AT_@ -76,16 +76,33 @@ index 4e7df12..902ad4e 100644
drw_setscheme(drw, scheme[SchemeNorm]);
drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
}
-_AT_@ -321,6 +335,161 @@ movewordedge(int dir)
+_AT_@ -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:
_AT_@ -232,13 +249,14 @@ index 4e7df12..902ad4e 100644
+ }
+ }
+
++draw:
+ drawmenu();
+}
+
static void
keypress(XKeyEvent *ev)
{
-_AT_@ -340,6 +509,18 @@ keypress(XKeyEvent *ev)
+_AT_@ -340,6 +527,18 @@ keypress(XKeyEvent *ev)
break;
}
_AT_@ -257,7 +275,7 @@ index 4e7df12..902ad4e 100644
if (ev->state & ControlMask) {
switch(ksym) {
case XK_a: ksym = XK_Home; break;
-_AT_@ -543,6 +724,8 @@ paste(void)
+_AT_@ -543,6 +742,8 @@ paste(void)
insert(p, (q = strchr(p, '
')) ? q - p : (ssize_t)strlen(p));
XFree(p);
}
_AT_@ -266,7 +284,7 @@ index 4e7df12..902ad4e 100644
drawmenu();
}
-_AT_@ -737,6 +920,11 @@ main(int argc, char *argv[])
+_AT_@ -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
_AT_@ -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`
Received on Fri Mar 31 2023 - 06:17:00 CEST
This archive was generated by hypermail 2.3.0
: Fri Mar 31 2023 - 06:24:51 CEST