ui: Rename… in a definition's item menu; the selection follows the new name (#290)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 10:17:28 -04:00
1 parent a0ae8b2111
commit dcf03e3378
5 files changed
+68 -3

No files matched your search

+10
View File
@@ -601,6 +601,16 @@ impl ModelApp {
e => Failure { message: e.to_string(), refused: None },
});
let changed = self.session.revision() != revision;
// The definition selected in the browser keeps its selection under its new name.
if id == "model.rename"
&& let Ok(v) = &r
&& let Some((def, name)) = &mut self.selected
&& def.rename_kind() == v["kind"].as_str()
&& v["from"].as_str() == Some(name.as_str())
&& let Some(to) = v["name"].as_str()
{
*name = to.to_string();
}
// A view change (hide, show) draws the model again, as an edit does.
if changed || self.session.view != view {
self.model_changed();