[hackers] [dmenu] fixed 3 bugs and some inconsistency || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Wed, 7 Apr 2010 16:15:47 +0000 (UTC)

changeset: 296:21b640a11fdc
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Wed Apr 07 16:15:34 2010 +0000
files: dmenu.c
description:
fixed 3 bugs and some inconsistency

diff -r c12572045630 -r 21b640a11fdc dmenu.c
--- a/dmenu.c Thu Apr 01 21:40:11 2010 +0100
+++ b/dmenu.c Wed Apr 07 16:15:34 2010 +0000
@@ -159,12 +159,12 @@
 
         if(!sub)
                 return (char *)s;
- if((c = *sub++) != 0) {
+ if((c = *sub++) != '\0') {
                 c = tolower(c);
                 len = strlen(sub);
                 do {
                         do {
- if((csub = *s++) == 0)
+ if((csub = *s++) == '\0')
                                         return NULL;
                         }
                         while(tolower(csub) != c);
@@ -220,7 +220,7 @@
         dc.x += promptw;
         dc.w = mw - promptw;
         /* print command */
- if(cmdw && item)
+ if(cmdw && item && !vlist)
                 dc.w = cmdw;
         drawtext(text[0] ? text : NULL, dc.norm);
         drawcursor();
@@ -371,7 +371,7 @@
         KeySym ksym;
 
         len = strlen(text);
- buf[0] = 0;
+ buf[0] = '\0';
         num = XLookupString(e, buf, sizeof buf, &ksym, NULL);
         if(IsKeypadKey(ksym)) {
                 if(ksym == XK_KP_Enter)
@@ -414,7 +414,8 @@
                         break;
                 case XK_u:
                 case XK_U:
- text[0] = 0;
+ cursor = 0;
+ text[0] = '\0';
                         match(text);
                         break;
                 case XK_w:
@@ -626,7 +627,7 @@
                         buf[--len] = '\0';
                 if(!(p = strdup(buf)))
                         eprint("fatal: could not strdup() %u bytes\n", len);
- if(max < len) {
+ if(max < len || !maxname) {
                         maxname = p;
                         max = len;
                 }
@@ -740,7 +741,7 @@
                 cmdw = MIN(textw(maxname), mw / 3);
         if(prompt)
                 promptw = MIN(textw(prompt), mw / 5);
- text[0] = 0;
+ text[0] = '\0';
         match(text);
         XMapRaised(dpy, win);
 }
Received on Wed Apr 07 2010 - 16:15:47 UTC

This archive was generated by hypermail 2.2.0 : Wed Apr 07 2010 - 16:24:07 UTC