@@ -1131,8 +1131,9 @@ pub struct Args {
11311131 /// `None` means "use the per-preset render default" (mirror).
11321132 pub palette_cycle_mode : Option < String > ,
11331133
1134- /// Character-selection strategy: brightness ramp, shape matching, or Sobel
1135- /// edge-orientation hybrid. TUI-only; affects Ascii/Braille/Sculpted.
1134+ /// Character-selection strategy (TUI/print only). `brightness` forces the
1135+ /// tonal ramp and `shape` the shape path on Ascii/Braille/Sculpted; `hybrid`
1136+ /// adds Sobel edge-orientation directional glyphs on Ascii only.
11361137 #[ arg( long = "glyph-selection" , value_name = "MODE" ) ]
11371138 pub glyph_selection : Option < String > ,
11381139
@@ -1997,7 +1998,7 @@ impl Args {
19971998 g. selection = Some ( s. parse ( ) ?) ;
19981999 }
19992000 if let Some ( t) = self . glyph_edge_threshold {
2000- g. edge_threshold = t;
2001+ g. edge_threshold = t. clamp ( 0.0 , 2.0 ) ;
20012002 }
20022003 Ok ( g)
20032004 }
@@ -2981,6 +2982,20 @@ mod tests {
29812982 assert_eq ! ( art. glyph. edge_threshold, 0.3 ) ;
29822983 }
29832984
2985+ #[ test]
2986+ fn glyph_edge_threshold_clamps_to_range ( ) {
2987+ let mut args = Args :: parse_from ( [ "tslime" ] ) ;
2988+ args. glyph_selection = Some ( "hybrid" . into ( ) ) ;
2989+ args. glyph_edge_threshold = Some ( 5.0 ) ;
2990+ let art = args. to_render_art_defaults ( ) . unwrap ( ) ;
2991+ assert_eq ! ( art. glyph. edge_threshold, 2.0 ) ;
2992+
2993+ let mut args = Args :: parse_from ( [ "tslime" ] ) ;
2994+ args. glyph_edge_threshold = Some ( -1.0 ) ;
2995+ let art = args. to_render_art_defaults ( ) . unwrap ( ) ;
2996+ assert_eq ! ( art. glyph. edge_threshold, 0.0 ) ;
2997+ }
2998+
29842999 #[ test]
29853000 fn no_glyph_flags_stay_identity ( ) {
29863001 let args = Args :: parse_from ( [ "tslime" ] ) ;
0 commit comments