[wiki] [sites] [dmenu] scroll patch: curpos adjustment fix || nzl

From: <git_AT_suckless.org>
Date: Sat, 24 Feb 2018 07:04:01 +0100

commit a12a226e9286319f819f657dbe0a8cd04cd353a0
Author: nzl <uruabi_AT_gmail.com>
Date: Sat Feb 24 14:02:35 2018 +0800

    [dmenu] scroll patch: curpos adjustment fix

diff --git a/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff b/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
index 53b1bd9d..8a8db2f3 100644
--- a/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
+++ b/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
_AT_@ -1,19 +1,19 @@
-From f424638a4a81ae24ec68eed2f1376b19354cac55 Mon Sep 17 00:00:00 2001
+From 32ae6bfb5f3a840443c52c9a53c27b126c3b59d0 Mon Sep 17 00:00:00 2001
 From: nzl <uruabi_AT_gmail.com>
-Date: Sat, 24 Feb 2018 00:31:00 +0800
+Date: Sat, 24 Feb 2018 13:47:59 +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 ++++++---
+ dmenu.c | 28 ++++++++---
  drw.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  drw.h | 2 +
- 3 files changed, 188 insertions(+), 7 deletions(-)
+ 3 files changed, 191 insertions(+), 8 deletions(-)
 
 diff --git a/dmenu.c b/dmenu.c
-index a246111..bc5e732 100644
+index a246111..d51b404 100644
 --- a/dmenu.c
 +++ b/dmenu.c
 _AT_@ -128,9 +128,11 @@ drawitem(struct item *item, int x, int y, int w)
_AT_@ -24,32 +24,36 @@ index a246111..bc5e732 100644
 + static int curpos, oldcurlen;
          struct item *item;
          int x = 0, y = 0, w;
-+ int curlen;
++ int curlen, rcurlen;
 + char ch;
  
          drw_setscheme(drw, scheme[SchemeNorm]);
          drw_rect(drw, 0, 0, mw, mh, 1, 1);
-_AT_@ -142,13 +144,21 @@ drawmenu(void)
+_AT_@ -141,14 +143,24 @@ drawmenu(void)
+ }
          /* draw input field */
          w = (lines > 0 || !matches) ? mw - x : inputw;
- drw_setscheme(drw, scheme[SchemeNorm]);
+- 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 Sat Feb 24 2018 - 07:04:01 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 24 2018 - 07:12:22 CET