aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarg@wmii.de2006-09-26 08:43:41 +0200
committerarg@wmii.de2006-09-26 08:43:41 +0200
commitc9465859a6eac7763d0b9049dca6bd34c163d8f6 (patch)
tree28e6dcd735abeb5d0585da1530d3a250f00a7dcc
parent1716159e05e712962c3a4c60091f6cd6b573461f (diff)
applied a change made by Uriel to dmenu (though I didn't applied everything)
-rw-r--r--main.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/main.c b/main.c
index 3203014..77a61b9 100644
--- a/main.c
+++ b/main.c
@@ -120,19 +120,8 @@ match(char *pattern) {
nitem = 0;
for(i = allitems; i; i=i->next)
- if(!plen || !strncmp(pattern, i->text, plen)) {
- if(!j)
- item = i;
- else
- j->right = i;
- i->left = j;
- i->right = NULL;
- j = i;
- nitem++;
- }
- for(i = allitems; i; i=i->next)
- if(plen && strncmp(pattern, i->text, plen)
- && strstr(i->text, pattern)) {
+ if(plen ? !strncmp(pattern, i->text, plen) :
+ strncmp(pattern, i->text, plen) && strstr(i->text, pattern)) {
if(!j)
item = i;
else
@@ -208,10 +197,8 @@ kpress(XKeyEvent * e) {
}
break;
case XK_Return:
- if(e->state & ShiftMask) {
- if(text)
- fprintf(stdout, "%s", text);
- }
+ if((e->state & ShiftMask) && text)
+ fprintf(stdout, "%s", text);
else if(sel)
fprintf(stdout, "%s", sel->text);
else if(text)