@@ -221,6 +221,23 @@ const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_va
221
221
else
222
222
return "display.bar must be an object" ;
223
223
}
224
+ else if (ffStrEqualsIgnCase (key , "fraction" ))
225
+ {
226
+ if (yyjson_is_obj (val ))
227
+ {
228
+ yyjson_val * ndigits = yyjson_obj_get (val , "ndigits" );
229
+ if (ndigits )
230
+ {
231
+ if (yyjson_is_null (ndigits ))
232
+ options -> fractionNdigits = -1 ;
233
+ else if (!yyjson_is_int (ndigits ))
234
+ return "display.fraction.ndigits must be an integer" ;
235
+ options -> fractionNdigits = (int8_t ) yyjson_get_int (ndigits );
236
+ }
237
+ }
238
+ else
239
+ return "display.fraction must be an object" ;
240
+ }
224
241
else if (ffStrEqualsIgnCase (key , "noBuffer" ))
225
242
options -> noBuffer = yyjson_get_bool (val );
226
243
else if (ffStrEqualsIgnCase (key , "keyWidth" ))
@@ -462,6 +479,8 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
462
479
else
463
480
return false;
464
481
}
482
+ else if (ffStrEqualsIgnCase (key , "-- fraction - ndigits "))
483
+ options -> fractionNdigits = (int8_t ) ffOptionParseInt32 (key , value );
465
484
else if (ffStrEqualsIgnCase (key , "-- no - buffer "))
466
485
options -> noBuffer = ffOptionParseBoolean (value );
467
486
else if (ffStrStartsWithIgnCase (key , "-- bar - "))
@@ -539,6 +558,7 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options)
539
558
ffStrbufInitStatic (& options -> percentColorYellow , instance .state .terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW );
540
559
ffStrbufInitStatic (& options -> percentColorRed , instance .state .terminalLightTheme ? FF_COLOR_FG_RED : FF_COLOR_FG_LIGHT_RED );
541
560
options -> freqNdigits = 2 ;
561
+ options -> fractionNdigits = -1 ;
542
562
543
563
ffListInit (& options -> constants , sizeof (FFstrbuf ));
544
564
}
0 commit comments