[wiki] [sites] [dmenu][scroll] update || nzl

From: <git_AT_suckless.org>
Date: Thu, 07 Jun 2018 07:09:30 +0200

commit 10c0bbd62abc7851f5dc238257c4c81ec82621aa
Author: nzl <uruabi_AT_gmail.com>
Date: Thu Jun 7 14:08:06 2018 +0900

    [dmenu][scroll] update

diff --git a/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff b/tools.suckless.org/dmenu/patches/dmenu-scroll-20180607-a314412.diff
similarity index 88%
rename from tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
rename to tools.suckless.org/dmenu/patches/dmenu-scroll-20180607-a314412.diff
index 8a8db2f3..7a7386a5 100644
--- a/tools.suckless.org/dmenu/patches/dmenu-scroll-20180224-8895128.diff
+++ b/tools.suckless.org/dmenu/patches/dmenu-scroll-20180607-a314412.diff
_AT_@ -1,22 +1,8 @@
-From 32ae6bfb5f3a840443c52c9a53c27b126c3b59d0 Mon Sep 17 00:00:00 2001
-From: nzl <uruabi_AT_gmail.com>
-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 |  28 ++++++++---
- drw.c   | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- drw.h   |   2 +
- 3 files changed, 191 insertions(+), 8 deletions(-)
-
 diff --git a/dmenu.c b/dmenu.c
-index a246111..d51b404 100644
+index 5c835dd..71efe52 100644
 --- a/dmenu.c
 +++ b/dmenu.c
-_AT_@ -128,9 +128,11 @@ drawitem(struct item *item, int x, int y, int w)
+_AT_@ -131,9 +131,10 @@ drawitem(struct item *item, int x, int y, int w)
  static void
  drawmenu(void)
  {
_AT_@ -25,11 +11,10 @@ index a246111..d51b404 100644
  	struct item *item;
  	int x = 0, y = 0, w;
 +	int curlen, rcurlen;
-+	char ch;
  
  	drw_setscheme(drw, scheme[SchemeNorm]);
  	drw_rect(drw, 0, 0, mw, mh, 1, 1);
-_AT_@ -141,14 +143,24 @@ drawmenu(void)
+_AT_@ -144,14 +145,21 @@ drawmenu(void)
  	}
  	/* draw input field */
  	w = (lines > 0 || !matches) ? mw - x : inputw;
_AT_@ -37,23 +22,20 @@ index a246111..d51b404 100644
 -	drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
 +	w -= lrpad / 2;
 +	x += lrpad / 2;
-+
-+	ch = text[cursor];
-+	text[cursor] = '-+	curlen = drw_fontset_getwidth(drw, text);
-+	text[cursor] = ch;
+ 
+-	curpos = TEXTW(text) - TEXTW(&text[cursor]);
+-	if ((curpos += lrpad / 2 - 1) < w) {
+-		drw_setscheme(drw, scheme[SchemeNorm]);
+-		drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
+-	}
 +	rcurlen = drw_fontset_getwidth(drw, text + cursor);
++	curlen = drw_fontset_getwidth(drw, text) - rcurlen;
 +	curpos += curlen - oldcurlen;
 +	curpos = MIN(w, MAX(0, curpos));
 +	curpos = MAX(curpos, w - rcurlen);
 +	curpos = MIN(curpos, curlen);
 +	oldcurlen = curlen;
- 
--	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);
--	}
++
 +	drw_setscheme(drw, scheme[SchemeNorm]);
 +	drw_text_align(drw, x, 0, curpos, bh, text, cursor, AlignR);
 +	drw_text_align(drw, x + curpos, 0, w - curpos, bh, text + cursor, strlen(text) - cursor, AlignL);
_AT_@ -261,6 +243,3 @@ index 4c67419..b66a83e 100644
  
  /* Map functions */
  void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
--- 
-2.15.1
-
diff --git a/tools.suckless.org/dmenu/patches/scroll.md b/tools.suckless.org/dmenu/patches/scroll.md
index 96033361..58b6861b 100644
--- a/tools.suckless.org/dmenu/patches/scroll.md
+++ b/tools.suckless.org/dmenu/patches/scroll.md
_AT_@ -7,7 +7,7 @@ in surf, after having inserted a long url via tab-completion.
 
 Download
 --------
-* [dmenu-scroll-20180224-8895128.diff](dmenu-scroll-20180224-8895128.diff)
+* [dmenu-scroll-20180607-a314412.diff](dmenu-scroll-20180607-a314412.diff)
 
 Author
 ------
Received on Thu Jun 07 2018 - 07:09:30 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 07 2018 - 07:12:30 CEST