[CONTACT]

[ABOUT]

[POLICY]

git clone dmenu dmenu Log gph

Found at: gopher.r-36.net:70/scm/dmenu/commit/f5bd1eed8d746414f5fbf9645124ccd54a095386.gph

tfast but inexact - dmenu - Dmenu fork with xft fonts.

git clone git://r-36.net/dmenu

Log

Files

Refs

README

LICENSE

---

commit f5bd1eed8d746414f5fbf9645124ccd54a095386

parent 1654d6cd6269bc784ee99045edd89e4bda24149f

Author: Connor Lane Smith

Date:   Sun, 15 May 2011 13:02:33 +0100
fast but inexact
Diffstat:
  dmenu.c                             |      11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---

diff --git a/dmenu.c b/dmenu.c

t@@ -444,19 +444,22 @@ paste(void) {
 void
 readstdin(void) {
-        char buf[sizeof text], *p;
-        size_t i, size = 0;
+        char buf[sizeof text], *p, *maxstr = NULL;
+        size_t i, max = 0, size = 0;
         for(i = 0; fgets(buf, sizeof buf, stdin); items[++i].text = NULL) {
-                if(i+1 == size / sizeof *items || !items)
+                if(i+1 >= size / sizeof *items)
                         if(!(items = realloc(items, (size += BUFSIZ))))
                                 eprintf("cannot realloc %u bytes:", size);
                 if((p = strchr(buf, '\n')))
                         *p = '\0';
                 if(!(items[i].text = strdup(buf)))
                         eprintf("cannot strdup %u bytes:", strlen(buf)+1);
-                inputw = MAX(inputw, textw(dc, items[i].text));
+                if(strlen(items[i].text) > max)
+                        max = strlen(maxstr = items[i].text);
         }
+        if(maxstr)
+                inputw = textw(dc, maxstr);
 }
 void
.


AD: