ref: 672db14015b4c9bea798368eb5747dbdbd665da4
parent: 1181f702c0ee4504eafb1a1134f7672a30217633
author: glenda <glenda@krsna>
date: Sun Aug 17 13:11:19 EDT 2025
validate-conf `
--- a/fc.c
+++ b/fc.c
@@ -808,31 +808,88 @@
void
validate_config(void)
{
+ /* Display dimensions */
if(config.banner_height < 0) config.banner_height = 0;
if(config.banner_height > 100) config.banner_height = 100;
-
+
+ if(config.status_height < 0) config.status_height = 0;
+ if(config.status_height > 100) config.status_height = 100;
+
+ if(config.status_margin < 0) config.status_margin = 0;
+ if(config.status_margin > 50) config.status_margin = 50;
+
+ /* Box layout */
+ if(config.box_label_offset_y < 0) config.box_label_offset_y = 0;
+ if(config.box_label_offset_y > 50) config.box_label_offset_y = 50;
+
+ if(config.box_text_margin < 0) config.box_text_margin = 0;
+ if(config.box_text_margin > 20) config.box_text_margin = 20;
+
+ if(config.formula_indicator_offset < 0) config.formula_indicator_offset = 0;
+ if(config.formula_indicator_offset > 30) config.formula_indicator_offset = 30;
+
+ /* Dialog dimensions */
+ if(config.dialog_width < 100) config.dialog_width = 100;
+ if(config.dialog_width > 800) config.dialog_width = 800;
+
+ if(config.dialog_height < 30) config.dialog_height = 30;
+ if(config.dialog_height > 300) config.dialog_height = 300;
+
+ if(config.dialog_padding < 0) config.dialog_padding = 0;
+ if(config.dialog_padding > 50) config.dialog_padding = 50;
+
+ /* Paragraph box dimensions */
+ if(config.paragraph_width < 64) config.paragraph_width = 64;
+ if(config.paragraph_width > 512) config.paragraph_width = 512;
+
+ if(config.paragraph_height < 32) config.paragraph_height = 32;
+ if(config.paragraph_height > 512) config.paragraph_height = 512;
+
+ /* Grid settings */
if(config.gridsize < 8) config.gridsize = 8;
if(config.gridsize > 256) config.gridsize = 256;
-
+
+ /* Emoji settings */
if(config.emoji_speed < 1) config.emoji_speed = 1;
if(config.emoji_speed > 20) config.emoji_speed = 20;
-
+
+ if(config.emoji_frame_delay < 1) config.emoji_frame_delay = 1;
+ if(config.emoji_frame_delay > 100) config.emoji_frame_delay = 100;
+
+ /* Timing intervals */
+ if(config.ctl_check_interval < 10) config.ctl_check_interval = 10;
+ if(config.ctl_check_interval > 1000) config.ctl_check_interval = 1000;
+
+ if(config.redraw_interval < 10) config.redraw_interval = 10;
+ if(config.redraw_interval > 1000) config.redraw_interval = 1000;
+
+ /* Formula settings */
if(config.formula_precision < 0) config.formula_precision = 0;
if(config.formula_precision > 10) config.formula_precision = 10;
-
+
if(config.max_eval_depth < 1) config.max_eval_depth = 1;
if(config.max_eval_depth > 100) config.max_eval_depth = 100;
-
+
if(config.max_recalc_passes < 1) config.max_recalc_passes = 1;
if(config.max_recalc_passes > 100) config.max_recalc_passes = 100;
-
+
+ /* File paths */
if(config.ctl_file[0] == '\0')
strcpy(config.ctl_file, DEFAULT_CTL_FILE);
if(config.default_save_path[0] == '\0')
strcpy(config.default_save_path, DEFAULT_SAVE_PATH);
-
+
+ /* Boolean values (ensure they're 0 or 1) */
+ config.emoji_enabled = config.emoji_enabled ? 1 : 0;
+ config.gridsnap = config.gridsnap ? 1 : 0;
+ config.show_formula_indicator = config.show_formula_indicator ? 1 : 0;
+
+ /* Note: Color values don't need validation as they're ulong hex values */
+ /* Any value is technically valid for a color */
+
update_formula_format();
}
+
void
apply_config(void)
{
--
⑨