[222_46] display consistent normalized font size across status bar and font size selector#2875
Conversation
|
Hi, another approach I thought to handle invalid input from the user is to show an error dialogue message. Let me know if this needs to be implemented, I'll create a seperate issue for it. Thanks! |
…n status bar and selector - Fix truncated decimal font sizes in status bar (get_env_double, round to 0.5) - Normalize and validate font size selector input (invalid defaults to 10)
b1c611c to
e200837
Compare
|
Thanks for the fix. The core logic looks good overall (consistent 0.5-step normalization and using get_env_double in the footer). The only significant issue I found is in the new Other input path:
Suggested change:
So yes, I think the main follow-up needed for this PR is adding the positivity check in the Other handler. |
|
Thanks for the review! I've added the positivity check — both handle-zero-and-negative-input.mp4 |
Fixes #2808
Decimal font sizes not displayed correctly in status bar and font size selector
Summary
Normalize font size display to the nearest 0.5 across the status bar and font size selector, ensuring consistent and accurate representation.
Developer document: devel/222_44.md
Issues Found
edit_footer.cpp,get_env_int(FONT_BASE_SIZE)truncates decimal values to integers.(int)casts, discarding any fractional part.document-menu.scmdisplays raw user input without normalization.normalize_half_multiple_size), arbitrary decimals like 10.3 are internally rounded to 10.5 but displayed as 10.3, causing a mismatch.Changes
get_env_inttoget_env_doubleforFONT_BASE_SIZEinedit_footer.cppto preserve decimal values.(int)cast withround(x * 2.0) / 2.0normalization for text, math, and prog modes in the status bar.font-base-size-menu-nameindocument-menu.scmto display the normalized font size instead of raw user input.init-font-base-size-interactiveto sanitize the "Other" input dialog — invalid or non-numeric entries default to 10.font-base-size-menu-nameinfold-menu.scmfor the beamer toolbar instead of raw string display.How to Test
Go to
Font Size->Other, then:how_to_test.mp4