@@ -68,6 +68,7 @@ void finish_config(struct mako_config *config) {
6868}
6969
7070void init_default_style (struct mako_style * style ) {
71+ style -> min_width = 0 ;
7172 style -> width = 300 ;
7273 style -> height = 100 ;
7374
@@ -223,6 +224,11 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
223224
224225 // Now on to actually setting things!
225226
227+ if (style -> spec .width ) {
228+ target -> min_width = style -> min_width ;
229+ target -> spec .min_width = true;
230+ }
231+
226232 if (style -> spec .width ) {
227233 target -> width = style -> width ;
228234 target -> spec .width = true;
@@ -411,6 +417,7 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
411417bool apply_superset_style (
412418 struct mako_style * target , struct mako_config * config ) {
413419 // Specify eveything that we'll be combining.
420+ target -> spec .min_width = true;
414421 target -> spec .width = true;
415422 target -> spec .height = true;
416423 target -> spec .outer_margin = true;
@@ -441,6 +448,7 @@ bool apply_superset_style(
441448 // We can cheat and skip checking whether any of these are specified,
442449 // since we're looking for the max and unspecified ones will be
443450 // initialized to zero.
451+ target -> min_width = max (style -> min_width , target -> min_width );
444452 target -> width = max (style -> width , target -> width );
445453 target -> height = max (style -> height , target -> height );
446454 target -> outer_margin .top = max (style -> outer_margin .top , target -> outer_margin .top );
@@ -566,6 +574,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
566574 parse_color (value , & style -> colors .background );
567575 } else if (strcmp (name , "text-color" ) == 0 ) {
568576 return spec -> colors .text = parse_color (value , & style -> colors .text );
577+ } else if (strcmp (name , "min-width" ) == 0 ) {
578+ return spec -> min_width = parse_int_ge (value , & style -> min_width , 1 );
569579 } else if (strcmp (name , "width" ) == 0 ) {
570580 return spec -> width = parse_int_ge (value , & style -> width , 1 );
571581 } else if (strcmp (name , "height" ) == 0 ) {
@@ -901,6 +911,7 @@ int parse_config_arguments(struct mako_config *config, int argc, char **argv) {
901911 {"text-color" , required_argument , 0 , 0 },
902912 {"width" , required_argument , 0 , 0 },
903913 {"height" , required_argument , 0 , 0 },
914+ {"min-width" , required_argument , 0 , 0 },
904915 {"outer-margin" , required_argument , 0 , 0 },
905916 {"margin" , required_argument , 0 , 0 },
906917 {"padding" , required_argument , 0 , 0 },
0 commit comments