feat(ui): 实现 UI 字体可配置化及全局布局自适应#151
Merged
Merged
Conversation
- 新增 UI 字体名称和字号配置项(外观设置 Text 区域) - 字号范围 8.0~20.0,默认 12.0,支持直接输入 - Appearance 新增 10 个语义化字号方法(overline/footnote/body/subheading/heading 等) - Dropdown/FilterableDropdown 组件高度自动跟随字号缩放 - SubmittableTextInput 按钮和 padding 动态适配字号 - 替换全部硬编码字号常量为 appearance 语义方法 - 设置页面输入框 padding/width 全部动态化 - 新增 dropdown_top_bar_height() 统一高度计算 - 修复字号输入框数字消失的问题(宽度动态化 + 避免不必要 buffer 重写)
Owner
|
@claude review this pr |
- UI 字号输入框在 Enter/Blur 时立即提交,与其他字号 editor 行为一致 (Finding 1: appearance_page.rs handle_ui_font_size_editor_event) - UI_FONT_SIZE_MIN/MAX/DEFAULT_UI_FONT_SIZE 收敛到 warp_core::ui::appearance, app/src/settings/font.rs 改为 pub use 重导出 (Finding 2 + 3: 去除硬编码 8.0/20.0 与常量重复定义) - 给 ui_font_overline 添加文档注释,说明与 overline_font_size 等价关系 (Finding 4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description 实现 UI 字体的字体族和字号可配置化,并确保所有 UI 组件在字号变化时自动适配布局。 数据模型: -
Appearance新增ui_font_size字段和AppearanceEvent::UiFontSizeChanged事件 - 新增 10 个语义化字号方法(ui_font_overline/ui_font_footnote/ui_font_body/ui_font_subheading/ui_font_heading _3/ui_font_heading_2/ui_font_heading_1/ui_font_display/ui_font_hero),全部基于ui_font_size按比例缩放 - 新增dropdown_top_bar_height()统一高度计算方法 设置 UI: - 外观设置 Text 区域新增 UI 字体族下拉框和字号输入框 - 字号范围 8.0~20.0,默认 12.0,直接输入 组件级自适应(根因修复,非逐个实例): -Dropdown/FilterableDropdown的top_bar_height改为Option<f32>,render 时自动从Appearance计算动态高度 — 覆盖全部 67 个实例 -SubmittableTextInput的按钮尺寸和 padding 改为基于字号的动态值 硬编码字号迁移: - 替换settings_page.rs、ai_page.rs、mcp_servers/style.rs、execution_profile_view.rs等文件中的全部硬编码字号常量为appearance语义方法 - 设置页面输入框的 padding/width 全部动态化 -working_directory.rs/startup_shell.rs的 TextInput 固定高度改为动态Description 实现 UI 字体的字体族和字号可配置化,并确保所有 UI 组件在字号变化时自动适配布局。 数据模型: -
Appearance新增ui_font_size字段和AppearanceEvent::UiFontSizeChanged事件 - 新增 10 个语义化字号方法(ui_font_overline/ui_font_footnote/ui_font_body/ui_font_subheading/ui_font_heading_3/ui_font_heading_2/ui_font_heading_1/ui_font_display/ui_font_hero),全部基于ui_font_size按比例缩放 - 新增dropdown_top_bar_height()统一高度计算方法 设置 UI: - 外观设置 Text 区域新增 UI 字体族下拉框和字号输入框 - 字号范围 8.0~20.0,默认 12.0,直接输入 组件级自适应(根因修复,非逐个实例): -Dropdown/FilterableDropdown的top_bar_height改为Option<f32>,render 时自动从Appearance计算动态高度 — 覆盖全部 67 个实例 -SubmittableTextInput的按钮尺寸和 padding 改为基于字号的动态值 硬编码字号迁移: - 替换settings_page.rs、ai_page.rs、mcp_servers/style.rs、execution_profile_view.rs等文件中的全部硬编码字号常量为appearance语义方法 - 设置页面输入框的 padding/width 全部动态化 -working_directory.rs/startup_shell.rs的 TextInput 固定高度改为动态 Bug 修复: - 修复 UI 字号输入框数字消失的问题:宽度动态化 + 避免不必要的set_buffer_text清空 ## Testing -crates/warp_core/src/ui/appearance_tests.rs:11 个单元测试覆盖语义化字号方法、比例缩放、层级排序、dropdown 高度计算 -cargo check -p warp编译通过,零错误零警告Agent Mode - [x] Zap Agent Mode - This PR was created via Zap's AI Agent Mode ## Changelog Entries for Stable CHANGELOG-NEW-FEATURE: UI 字体可配置化 — 支持自定义 UI 字体族和字号(8~20),所有界面元素自动适配 CHANGELOG-IMPROVEMENT: 所有下拉框、输入框和文本元素自动跟随 UI 字号缩放