From afdcc0e968a51715705a6a3b16bf1804d42f955a Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Fri, 30 Jul 2021 12:17:51 +0200 Subject: [PATCH 1/4] Fix expression changing during editing --- src/rust/ide/src/ide/integration/project.rs | 7 +++++-- .../ide/view/graph-editor/src/component/node/expression.rs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rust/ide/src/ide/integration/project.rs b/src/rust/ide/src/ide/integration/project.rs index a71fc023be..85118ed33a 100644 --- a/src/rust/ide/src/ide/integration/project.rs +++ b/src/rust/ide/src/ide/integration/project.rs @@ -863,12 +863,15 @@ impl Model { }; let expression_changed = !self.expression_views.borrow().get(&id).contains(&&code_and_trees); - if expression_changed { + let node_is_edited = self.view.graph().frp.node_being_edited.value().contains(&id); + if expression_changed && !node_is_edited { + DEBUG!("{self.expression_views.borrow().get(&id):?} compared with {code_and_trees:?}"); for sub_expression in node.info.ast().iter_recursive() { if let Some(expr_id) = sub_expression.id { self.node_view_by_expression.borrow_mut().insert(expr_id,id); } } + info!(self.logger, "Refreshing node {id:?} expression"); self.view.graph().frp.input.set_node_expression.emit(&(id,code_and_trees.clone())); self.expression_views.borrow_mut().insert(id,code_and_trees); } @@ -1338,7 +1341,7 @@ impl Model { Ok(()) }, Err(err) => { - self.view.graph().frp.remove_node.emit(displayed_id); + self.view.graph().frp.remove_node(displayed_id); Err(err) } } diff --git a/src/rust/ide/view/graph-editor/src/component/node/expression.rs b/src/rust/ide/view/graph-editor/src/component/node/expression.rs index 10ebb22109..6fd177ba30 100644 --- a/src/rust/ide/view/graph-editor/src/component/node/expression.rs +++ b/src/rust/ide/view/graph-editor/src/component/node/expression.rs @@ -9,7 +9,7 @@ use span_tree::traits::*; // === Expression === // ================== -#[derive(Clone,Default,Eq,PartialEq)] +#[derive(Clone,Debug,Default,Eq,PartialEq)] pub struct Expression { pub pattern : Option, pub code : String, @@ -30,7 +30,7 @@ impl Expression { } } -impl Debug for Expression { +impl Display for Expression { fn fmt(&self, f:&mut fmt::Formatter<'_>) -> fmt::Result { write!(f,"Expression({})",self.code) } From 9775e41d2f8e2e23b9af2d339432818d20e20ac8 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Fri, 30 Jul 2021 12:26:27 +0200 Subject: [PATCH 2/4] Remove debug print --- src/rust/ide/src/ide/integration/project.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/rust/ide/src/ide/integration/project.rs b/src/rust/ide/src/ide/integration/project.rs index 85118ed33a..c0a6d64372 100644 --- a/src/rust/ide/src/ide/integration/project.rs +++ b/src/rust/ide/src/ide/integration/project.rs @@ -865,7 +865,6 @@ impl Model { !self.expression_views.borrow().get(&id).contains(&&code_and_trees); let node_is_edited = self.view.graph().frp.node_being_edited.value().contains(&id); if expression_changed && !node_is_edited { - DEBUG!("{self.expression_views.borrow().get(&id):?} compared with {code_and_trees:?}"); for sub_expression in node.info.ast().iter_recursive() { if let Some(expr_id) = sub_expression.id { self.node_view_by_expression.borrow_mut().insert(expr_id,id); From fadbf30fc4bbb13dd9078a7774ba3a89af445c33 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Fri, 30 Jul 2021 12:32:32 +0200 Subject: [PATCH 3/4] Changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad50e93d4..2b29bfae62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,19 @@ these updates be shipped in a stable release before the end of the year. details in [the engine release notes](https://github.com/enso-org/enso/blob/main/RELEASES.md). +
![Bug Fixes](/docs/assets/tags/bug_fixes.svg) + +#### Visual Environment + +- [Fixed a bug where edited node expression was sometimes altered.][1743]. When + editing node expression, the changes were occasionally reverted, or the + grayed-out parameter names were added to the actual expression. +
[1700]: https://github.com/enso-org/ide/pull/1700 [1726]: https://github.com/enso-org/ide/pull/1726 +[1743]: https://github.com/enso-org/ide/pull/1743 # Enso 2.0.0-alpha.10 (2021-07-23) From 2f71a923a893a45b966ecf8a4c6bd62ef05ef8ef Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Fri, 30 Jul 2021 13:35:58 +0200 Subject: [PATCH 4/4] Applying @mwu-tow review --- src/rust/ide/src/ide/integration/project.rs | 4 ++-- .../ide/view/graph-editor/src/component/node/expression.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rust/ide/src/ide/integration/project.rs b/src/rust/ide/src/ide/integration/project.rs index c0a6d64372..c6fce38b84 100644 --- a/src/rust/ide/src/ide/integration/project.rs +++ b/src/rust/ide/src/ide/integration/project.rs @@ -863,8 +863,8 @@ impl Model { }; let expression_changed = !self.expression_views.borrow().get(&id).contains(&&code_and_trees); - let node_is_edited = self.view.graph().frp.node_being_edited.value().contains(&id); - if expression_changed && !node_is_edited { + let node_is_being_edited = self.view.graph().frp.node_being_edited.value().contains(&id); + if expression_changed && !node_is_being_edited { for sub_expression in node.info.ast().iter_recursive() { if let Some(expr_id) = sub_expression.id { self.node_view_by_expression.borrow_mut().insert(expr_id,id); diff --git a/src/rust/ide/view/graph-editor/src/component/node/expression.rs b/src/rust/ide/view/graph-editor/src/component/node/expression.rs index 6fd177ba30..18c84ef6ab 100644 --- a/src/rust/ide/view/graph-editor/src/component/node/expression.rs +++ b/src/rust/ide/view/graph-editor/src/component/node/expression.rs @@ -32,7 +32,7 @@ impl Expression { impl Display for Expression { fn fmt(&self, f:&mut fmt::Formatter<'_>) -> fmt::Result { - write!(f,"Expression({})",self.code) + Display::fmt(&self.code,f) } }