@@ -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 = 300 ;
7172 style -> width = 300 ;
7273 style -> height = 100 ;
7374
@@ -218,6 +219,11 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
218219
219220 // Now on to actually setting things!
220221
222+ if (style -> spec .width ) {
223+ target -> min_width = style -> min_width ;
224+ target -> spec .min_width = true;
225+ }
226+
221227 if (style -> spec .width ) {
222228 target -> width = style -> width ;
223229 target -> spec .width = true;
@@ -401,6 +407,7 @@ bool apply_style(struct mako_style *target, const struct mako_style *style) {
401407bool apply_superset_style (
402408 struct mako_style * target , struct mako_config * config ) {
403409 // Specify eveything that we'll be combining.
410+ target -> spec .min_width = true;
404411 target -> spec .width = true;
405412 target -> spec .height = true;
406413 target -> spec .outer_margin = true;
@@ -430,6 +437,7 @@ bool apply_superset_style(
430437 // We can cheat and skip checking whether any of these are specified,
431438 // since we're looking for the max and unspecified ones will be
432439 // initialized to zero.
440+ target -> min_width = max (style -> min_width , target -> min_width );
433441 target -> width = max (style -> width , target -> width );
434442 target -> height = max (style -> height , target -> height );
435443 target -> outer_margin .top = max (style -> outer_margin .top , target -> outer_margin .top );
@@ -528,6 +536,8 @@ static bool apply_style_option(struct mako_style *style, const char *name,
528536 parse_color (value , & style -> colors .background );
529537 } else if (strcmp (name , "text-color" ) == 0 ) {
530538 return spec -> colors .text = parse_color (value , & style -> colors .text );
539+ } else if (strcmp (name , "min-width" ) == 0 ) {
540+ return spec -> min_width = parse_int_ge (value , & style -> min_width , 1 );
531541 } else if (strcmp (name , "width" ) == 0 ) {
532542 return spec -> width = parse_int_ge (value , & style -> width , 1 );
533543 } else if (strcmp (name , "height" ) == 0 ) {
@@ -845,6 +855,7 @@ int parse_config_arguments(struct mako_config *config, int argc, char **argv) {
845855 {"font" , required_argument , 0 , 0 },
846856 {"background-color" , required_argument , 0 , 0 },
847857 {"text-color" , required_argument , 0 , 0 },
858+ {"min-width" , required_argument , 0 , 0 },
848859 {"width" , required_argument , 0 , 0 },
849860 {"height" , required_argument , 0 , 0 },
850861 {"outer-margin" , required_argument , 0 , 0 },
0 commit comments