[wiki] [sites] [dmenu][PATCH] Add patch that implements text scrolling || nzl
commit 2c7c5d85c957b4955b858c6fb55800d91d555187
Author: nzl <uruabi_AT_gmail.com>
Date: Sat Feb 24 01:14:43 2018 +0800
[dmenu][PATCH] Add patch that implements text scrolling
diff --git a/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff b/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
new file mode 100644
index 00000000..53b1bd9d
--- /dev/null
+++ b/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
_AT_@ -0,0 +1,262 @@
+From f424638a4a81ae24ec68eed2f1376b19354cac55 Mon Sep 17 00:00:00 2001
+From: nzl <uruabi_AT_gmail.com>
+Date: Sat, 24 Feb 2018 00:31:00 +0800
+Subject: [PATCH] Implement text scrolling
+
+a new function drw_text_align is added, it is different from drw_text in that
+it doesn't append '...' for long text, and it allows drawing text right
+justified.
+---
+ dmenu.c | 24 ++++++---
+ drw.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ drw.h | 2 +
+ 3 files changed, 188 insertions(+), 7 deletions(-)
+
+diff --git a/dmenu.c b/dmenu.c
+index a246111..bc5e732 100644
+--- a/dmenu.c
++++ b/dmenu.c
+_AT_@ -128,9 +128,11 @@ drawitem(struct item *item, int x, int y, int w)
+ static void
+ drawmenu(void)
+ {
+- unsigned int curpos;
++ static int curpos, oldcurlen;
+ struct item *item;
+ int x = 0, y = 0, w;
++ int curlen;
++ char ch;
+
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ drw_rect(drw, 0, 0, mw, mh, 1, 1);
+_AT_@ -142,13 +144,21 @@ drawmenu(void)
+ /* draw input field */
+ w = (lines > 0 || !matches) ? mw - x : inputw;
+ drw_setscheme(drw, scheme[SchemeNorm]);
+- drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
++ w -= lrpad / 2;
++ x += lrpad / 2;
+
+- drw_font_getexts(drw->fonts, text, cursor, &curpos, NULL);
+- if ((curpos += lrpad / 2 - 1) < w) {
+- drw_setscheme(drw, scheme[SchemeNorm]);
+- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
+- }
++ ch = text[cursor];
++ text[cursor] = '
Received on Fri Feb 23 2018 - 18:17:18 CET
This archive was generated by hypermail 2.3.0
: Fri Feb 23 2018 - 18:24:29 CET