fix(ui): keep a typed layer or style name when the field loses focus

Renaming a layer or a style was only applied on Enter; clicking anywhere
else dropped the typed name. A click that moves focus off a field whose
text changed now commits it. New and Copy in the style managers open the
generated name for renaming, so a new style can be named right away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-13 11:19:12 +03:00
1 parent 4639546472
commit f6503ad4d3
5 files changed
+93 -46

No files matched your search

+7
View File
@@ -1337,6 +1337,8 @@ pub(super) struct OpenCADStudio {
style_rename: Option<String>,
/// Edit buffer for the inline rename text input.
style_rename_buf: String,
/// The style manager the open rename belongs to.
style_rename_kind: Option<style_ops::StyleKind>,
/// Active style-manager transaction. Edits mutate the document live for an
/// in-dialog preview but only persist on Apply; closing without Apply
/// restores this snapshot. `None` when no style manager is staging.
@@ -3078,6 +3080,10 @@ pub enum Message {
LayerLineweightSet(LineWeight),
LayerTransparencyEdit(String, String),
LayerRenameCommit,
/// The widget focused after a click while a layer rename is open.
LayerRenameFocus(Option<iced::advanced::widget::Id>),
/// The widget focused after a click while a style rename is open.
StyleRenameFocus(Option<iced::advanced::widget::Id>),
// ── Layer State Manager ─────────────────────────────────────────────
LayerStateManagerOpen,
LayerStateManagerSelect(String),
@@ -4880,6 +4886,7 @@ impl OpenCADStudio {
// TextStyle font browser
style_rename: None,
style_rename_buf: String::new(),
style_rename_kind: None,
style_stage: None,
textstyle_selected: "Standard".to_string(),
textstyle_tab: 0,