From 1d4ac76cbcc82a340d7e17b6b4ed9bbfcb8814d2 Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Fri, 19 Jun 2026 09:35:08 +0800 Subject: [PATCH] refactor(editor): dedup native format_panel_number into op-editor-ui::util Follow-up to the helper hoist: op-host-native press_helpers.rs still carried a byte-identical format_panel_number copy (flagged in codex review). Re-point it to the shared op_editor_ui::util helper. --- crates/op-host-native/src/widget_host/press_helpers.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/crates/op-host-native/src/widget_host/press_helpers.rs b/crates/op-host-native/src/widget_host/press_helpers.rs index 54b63a23f..f7755f65b 100644 --- a/crates/op-host-native/src/widget_host/press_helpers.rs +++ b/crates/op-host-native/src/widget_host/press_helpers.rs @@ -3,6 +3,7 @@ //! agent-settings modal press dispatcher. use super::WidgetHostNative; +use op_editor_ui::util::format_panel_number; use op_editor_ui::Point2D; fn create_initial_size_for_tool(tool: op_editor_core::Tool) -> (f64, f64) { @@ -843,14 +844,6 @@ pub(in crate::widget_host) fn property_focus_initial( } } -fn format_panel_number(value: f32) -> String { - if value.fract().abs() < f32::EPSILON { - format!("{}", value.round() as i32) - } else { - format!("{value:.2}") - } -} - /// Translate a shell-core `ColorTarget` into op-editor-core's — used /// by `press.rs`'s `OpenColorPicker` branch. pub(in crate::widget_host) fn color_target(