ensure align = left is the default and update documentation accordingly

fixes #1403
This commit is contained in:
Ingo Bürk 2014-12-02 21:38:30 +01:00 committed by Michael Stapelberg
parent 58c65a64fe
commit bf1d0c9335
3 changed files with 5 additions and 4 deletions

View File

@ -148,7 +148,7 @@ min_width::
when you want to set a sensible minimum width regardless of which font you
are using, and at what particular size.
align::
Align text on the +center+ (default), +right+ or +left+ of the block, when
Align text on the +center+, +right+ or +left+ (default) of the block, when
the minimum width of the latter, specified by the +min_width+ key, is not
reached.
name and instance::

View File

@ -27,6 +27,7 @@ struct rect_t {
};
typedef enum {
/* First value to make it the default. */
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT

View File

@ -188,12 +188,12 @@ static int stdin_string(void *context, const unsigned char *val, size_t len) {
sasprintf(&(ctx->block.color), "%.*s", len, val);
}
if (strcasecmp(ctx->last_map_key, "align") == 0) {
if (len == strlen("left") && !strncmp((const char *)val, "left", strlen("left"))) {
ctx->block.align = ALIGN_LEFT;
if (len == strlen("center") && !strncmp((const char *)val, "center", strlen("center"))) {
ctx->block.align = ALIGN_CENTER;
} else if (len == strlen("right") && !strncmp((const char *)val, "right", strlen("right"))) {
ctx->block.align = ALIGN_RIGHT;
} else {
ctx->block.align = ALIGN_CENTER;
ctx->block.align = ALIGN_LEFT;
}
} else if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
i3String *text = i3string_from_utf8_with_length((const char *)val, len);