Compare commits

...

3 Commits
4.1 ... 4.1.1

Author SHA1 Message Date
851672cadc prepared bugfix release 4.1.1 2010-05-29 12:56:33 +01:00
504b797be8 applied Ramils patch 2010-05-29 12:55:38 +01:00
503ca75af4 Added tag 4.1 for changeset 844587572673 2010-05-28 11:42:54 +01:00
3 changed files with 23 additions and 11 deletions

View File

@ -40,3 +40,4 @@ e4c81a78ffbad6ba4d1ad119cc654da6eca63a4c 3.2
644b0798fcccd570fd519899e1601c6857496b91 3.8 644b0798fcccd570fd519899e1601c6857496b91 3.8
21a1ed9a69b9541a355758a57103e294fb722c33 3.9 21a1ed9a69b9541a355758a57103e294fb722c33 3.9
78f9f72cc9c6bdb022ff8908486b61ef5e242aad 4.0 78f9f72cc9c6bdb022ff8908486b61ef5e242aad 4.0
844587572673cf6326c3f61737264a46b728fc0a 4.1

View File

@ -1,5 +1,5 @@
# dmenu version # dmenu version
VERSION = 4.1 VERSION = 4.1.1
# Customize below to fit your system # Customize below to fit your system

31
dmenu.c
View File

@ -19,6 +19,7 @@
#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b))
#define IS_UTF8_1ST_CHAR(c) ((((c) & 0xc0) == 0xc0) || !((c) & 0x80))
/* enums */ /* enums */
enum { ColFG, ColBG, ColLast }; enum { ColFG, ColBG, ColLast };
@ -360,7 +361,7 @@ initfont(const char *fontstr) {
void void
kpress(XKeyEvent * e) { kpress(XKeyEvent * e) {
char buf[sizeof text]; char buf[sizeof text];
int i, num; int i, num, off;
unsigned int len; unsigned int len;
KeySym ksym; KeySym ksym;
@ -475,13 +476,19 @@ kpress(XKeyEvent * e) {
break; break;
case XK_BackSpace: case XK_BackSpace:
if(cursor > 0) { if(cursor > 0) {
memmove(text + cursor - 1, text + cursor, sizeof text - cursor + 1); off = 1;
cursor--; while(cursor > off && !IS_UTF8_1ST_CHAR(text[cursor - off]))
off++;
memmove(text + cursor - off, text + cursor, sizeof text - cursor + off);
cursor -= off;
match(text); match(text);
} }
break; break;
case XK_Delete: case XK_Delete:
memmove(text + cursor, text + cursor + 1, sizeof text - cursor); off = 1;
while(cursor + off < sizeof text - 1 && !IS_UTF8_1ST_CHAR(text[cursor + off]))
off++;
memmove(text + cursor, text + cursor + off, sizeof text - cursor);
match(text); match(text);
break; break;
case XK_End: case XK_End:
@ -517,9 +524,11 @@ kpress(XKeyEvent * e) {
calcoffsets(); calcoffsets();
} }
} }
else if(cursor > 0) else if(cursor > 0) {
cursor--; do {
else cursor--;
} while(cursor > 0 && !IS_UTF8_1ST_CHAR(text[cursor]));
} else
return; return;
break; break;
case XK_Next: case XK_Next:
@ -544,9 +553,11 @@ kpress(XKeyEvent * e) {
break; break;
case XK_Right: case XK_Right:
case XK_Down: case XK_Down:
if(cursor < len) if(cursor < len) {
cursor++; do {
else if(sel && sel->right) { cursor++;
} while(cursor < len && !IS_UTF8_1ST_CHAR(text[cursor]));
} else if(sel && sel->right) {
sel=sel->right; sel=sel->right;
if(sel == next) { if(sel == next) {
curr = next; curr = next;