Allow ']' char in string of \s[] sequences, by adding a \ before

This commit is contained in:
Martin Duquesnoy 2012-01-27 18:26:18 +01:00
parent 2ad1e52051
commit aa71bf00f9
3 changed files with 13 additions and 6 deletions

View File

@ -446,7 +446,6 @@ client_frame_update(struct client *c, struct colpair *cp)
} }
} }
void void
client_tab_focus(struct client *c) client_tab_focus(struct client *c)
{ {
@ -490,7 +489,7 @@ client_tab_focus(struct client *c)
void void
_client_tab(struct client *c, struct client *cm) _client_tab(struct client *c, struct client *cm)
{ {
int m[2] = { CLIENT_TILED, CLIENT_FREE }; long m[2] = { CLIENT_TILED, CLIENT_FREE };
/* Do not tab already tabed client */ /* Do not tab already tabed client */
if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER) if(c->flags & (CLIENT_TABBED | CLIENT_TABMASTER)
@ -1147,7 +1146,7 @@ _fac_check_to_reverse(struct client *c)
* Reverse back the flag and the window geo * Reverse back the flag and the window geo
* in previous affected clients * in previous affected clients
*/ */
SLIST_FOREACH(cc, &c->tag->clients, tnext) FOREACH_NFCLIENT(cc, &c->tag->clients, tnext)
{ {
cc->tgeo = cc->ttgeo; cc->tgeo = cc->ttgeo;
cc->flags &= ~CLIENT_DID_WINSIZE; cc->flags &= ~CLIENT_DID_WINSIZE;

View File

@ -92,7 +92,7 @@ status_parse(struct status_ctx *ctx)
struct status_seq *sq, *prev = NULL; struct status_seq *sq, *prev = NULL;
int i, shift = 0; int i, shift = 0;
char *dstr = xstrdup(ctx->status), *sauv = dstr; char *dstr = xstrdup(ctx->status), *sauv = dstr;
char type, *p, *end, *arg[6] = { NULL }; char type, *p, *pp, *end, *arg[6] = { NULL };
for(; *dstr; ++dstr) for(; *dstr; ++dstr)
{ {
@ -102,7 +102,11 @@ status_parse(struct status_ctx *ctx)
p = ++dstr; p = ++dstr;
if(!(strchr("sRi", *p)) || !(end = strchr(p, ']'))) /* Search end of sequence (] without \ behind) */
for(end = strchr(p, ']'); *(end - 1) == '\\';)
end = strchr(end + 1, ']');
if(!(strchr("sRi", *p)) || !end )
continue; continue;
/* Then parse & list it */ /* Then parse & list it */
@ -119,6 +123,10 @@ status_parse(struct status_ctx *ctx)
sq->color = color_atoh(arg[1 + shift]); sq->color = color_atoh(arg[1 + shift]);
sq->str = xstrdup(arg[2 + shift]); sq->str = xstrdup(arg[2 + shift]);
/* Remove \ from string */
for(pp = sq->str; (pp = strchr(sq->str, '\\'));)
memmove(pp, pp + 1, strlen(pp));
break; break;
/* /*

View File

@ -126,7 +126,7 @@ parse_args(char *str, char delim, char end, int narg, char *args[])
{ {
int i = 0; int i = 0;
for(args[0] = str; *str && *str != end && i < narg; ++str) for(args[0] = str; *str && (*str != end || *(str - 1) == '\\') && i < narg; ++str)
if(*str == delim) if(*str == delim)
{ {
*str = '\0'; *str = '\0';