theme: Clamp font sizes between 6px and 100px (#17829)

This PR clamps the `ui_font_size` and `buffer_font_size` settings
between 6px and 100px.

Release Notes:

- Changed `ui_font_size` and `buffer_font_size` to require values to be
between 6px and 100px (inclusive).
This commit is contained in:
Marshall Bowers 2024-09-14 15:44:54 -04:00 committed by GitHub
parent e8a2dd92c8
commit 4d8c3855c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -609,10 +609,14 @@ impl settings::Settings for ThemeSettings {
this.apply_theme_overrides(); this.apply_theme_overrides();
merge(&mut this.ui_font_size, value.ui_font_size.map(Into::into)); merge(&mut this.ui_font_size, value.ui_font_size.map(Into::into));
this.ui_font_size = this.ui_font_size.clamp(px(6.), px(100.));
merge( merge(
&mut this.buffer_font_size, &mut this.buffer_font_size,
value.buffer_font_size.map(Into::into), value.buffer_font_size.map(Into::into),
); );
this.buffer_font_size = this.buffer_font_size.clamp(px(6.), px(100.));
merge(&mut this.buffer_line_height, value.buffer_line_height); merge(&mut this.buffer_line_height, value.buffer_line_height);
// Clamp the `unnecessary_code_fade` to ensure text can't disappear entirely. // Clamp the `unnecessary_code_fade` to ensure text can't disappear entirely.