fixed 3 bugs and some inconsistency
e3623cd7
1 file(s) · +8 −7
| 159 | 159 | ||
| 160 | 160 | if(!sub) |
|
| 161 | 161 | return (char *)s; |
|
| 162 | - | if((c = *sub++) != 0) { |
|
| 162 | + | if((c = *sub++) != '\0') { |
|
| 163 | 163 | c = tolower(c); |
|
| 164 | 164 | len = strlen(sub); |
|
| 165 | 165 | do { |
|
| 166 | 166 | do { |
|
| 167 | - | if((csub = *s++) == 0) |
|
| 167 | + | if((csub = *s++) == '\0') |
|
| 168 | 168 | return NULL; |
|
| 169 | 169 | } |
|
| 170 | 170 | while(tolower(csub) != c); |
|
| 220 | 220 | dc.x += promptw; |
|
| 221 | 221 | dc.w = mw - promptw; |
|
| 222 | 222 | /* print command */ |
|
| 223 | - | if(cmdw && item) |
|
| 223 | + | if(cmdw && item && !vlist) |
|
| 224 | 224 | dc.w = cmdw; |
|
| 225 | 225 | drawtext(text[0] ? text : NULL, dc.norm); |
|
| 226 | 226 | drawcursor(); |
|
| 371 | 371 | KeySym ksym; |
|
| 372 | 372 | ||
| 373 | 373 | len = strlen(text); |
|
| 374 | - | buf[0] = 0; |
|
| 374 | + | buf[0] = '\0'; |
|
| 375 | 375 | num = XLookupString(e, buf, sizeof buf, &ksym, NULL); |
|
| 376 | 376 | if(IsKeypadKey(ksym)) { |
|
| 377 | 377 | if(ksym == XK_KP_Enter) |
|
| 414 | 414 | break; |
|
| 415 | 415 | case XK_u: |
|
| 416 | 416 | case XK_U: |
|
| 417 | - | text[0] = 0; |
|
| 417 | + | cursor = 0; |
|
| 418 | + | text[0] = '\0'; |
|
| 418 | 419 | match(text); |
|
| 419 | 420 | break; |
|
| 420 | 421 | case XK_w: |
|
| 626 | 627 | buf[--len] = '\0'; |
|
| 627 | 628 | if(!(p = strdup(buf))) |
|
| 628 | 629 | eprint("fatal: could not strdup() %u bytes\n", len); |
|
| 629 | - | if(max < len) { |
|
| 630 | + | if(max < len || !maxname) { |
|
| 630 | 631 | maxname = p; |
|
| 631 | 632 | max = len; |
|
| 632 | 633 | } |
|
| 740 | 741 | cmdw = MIN(textw(maxname), mw / 3); |
|
| 741 | 742 | if(prompt) |
|
| 742 | 743 | promptw = MIN(textw(prompt), mw / 5); |
|
| 743 | - | text[0] = 0; |
|
| 744 | + | text[0] = '\0'; |
|
| 744 | 745 | match(text); |
|
| 745 | 746 | XMapRaised(dpy, win); |
|
| 746 | 747 | } |
|