From cd4d1c2535146e6692eee5879e56ff85bdd9472d Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 12 Jun 2026 14:18:31 +0300 Subject: [PATCH] fix(layout): focus inline rename field on RENAME Renaming a layout tab left keyboard focus on the command line, so typed characters landed there until the user clicked the tab. Give the inline rename text_input a stable id and return a focus task when the rename starts so the user types straight into the field. (issue #86) Co-Authored-By: Claude Opus 4.8 --- src/app/update.rs | 5 +++++ src/ui/statusbar.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/app/update.rs b/src/app/update.rs index bd235a82..b6ec6ca1 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -5103,6 +5103,11 @@ impl OpenCADStudio { if name != "Model" { self.layout_rename_state = Some((name.clone(), name)); self.layout_context_menu = None; + // Focus the inline field so the user types into it + // directly instead of the command line (issue #86). + return iced::widget::operation::focus(iced::widget::Id::new( + crate::ui::statusbar::LAYOUT_RENAME_INPUT_ID, + )); } Task::none() } diff --git a/src/ui/statusbar.rs b/src/ui/statusbar.rs index c757437a..2cb4c163 100644 --- a/src/ui/statusbar.rs +++ b/src/ui/statusbar.rs @@ -4,6 +4,10 @@ use iced::widget::tooltip::Position as TipPos; use iced::widget::{button, container, mouse_area, row, text, text_input, tooltip, Row}; use iced::{Background, Border, Color, Element, Length, Theme}; +/// Widget id of the inline layout-rename text input, so the rename can grab +/// keyboard focus the moment it opens (issue #86). +pub const LAYOUT_RENAME_INPUT_ID: &str = "layout_rename_input"; + use crate::app::Message; use crate::snap::Snapper; use crate::ui::statusbar_config::{StatusBarConfig, StatusPill}; @@ -574,6 +578,7 @@ fn space_tab<'a>( if let Some(edit_val) = rename_edit { // Inline rename text input with a cancel (✕) button. let input = text_input("", edit_val) + .id(iced::widget::Id::new(LAYOUT_RENAME_INPUT_ID)) .on_input(Message::LayoutRenameEdit) .on_submit(Message::LayoutRenameCommit) .size(11)